From 9ce2280e9fbb8edfecd322d4ff43da5dae14f24f Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 15 Dec 2025 10:11:30 +0530 Subject: [PATCH 1/3] fixed errors, refactored Signed-off-by: Ujjwal Kumar --- builder/ibmcloud/vpc/client.go | 3 +- builder/ibmcloud/vpc/step_create_instance.go | 154 ++++++++++-------- .../ibmcloud/vpc/step_create_ssh_key_pair.go | 9 +- .../ibmcloud/vpc/step_create_ssh_key_vpc.go | 30 +++- builder/ibmcloud/vpc/step_get_ip.go | 3 +- builder/ibmcloud/vpc/step_waitfor_instance.go | 127 +-------------- 6 files changed, 115 insertions(+), 211 deletions(-) diff --git a/builder/ibmcloud/vpc/client.go b/builder/ibmcloud/vpc/client.go index 3c672669..9cb96da6 100755 --- a/builder/ibmcloud/vpc/client.go +++ b/builder/ibmcloud/vpc/client.go @@ -2,7 +2,6 @@ package vpc import ( "fmt" - "io/ioutil" "log" "net/http" "os" @@ -371,7 +370,7 @@ func (client IBMCloudClient) createSSHKeyVPC(state multistep.StateBag) (*vpcv1.K config := state.Get("config").(Config) file := state.Get("PUBLIC_KEY").(string) - content, err := ioutil.ReadFile(file) + content, err := os.ReadFile(file) if err != nil { err := fmt.Errorf("[ERROR] Error reading SSH Public Key. Error: %s", err) ui.Error(err.Error()) diff --git a/builder/ibmcloud/vpc/step_create_instance.go b/builder/ibmcloud/vpc/step_create_instance.go index 5071cccf..50c33c16 100644 --- a/builder/ibmcloud/vpc/step_create_instance.go +++ b/builder/ibmcloud/vpc/step_create_instance.go @@ -3,7 +3,7 @@ package vpc import ( "context" "fmt" - "io/ioutil" + "os" "time" "github.com/IBM/vpc-go-sdk/vpcv1" @@ -99,7 +99,7 @@ func (step *stepCreateInstance) Run(_ context.Context, state multistep.StateBag) userDataFilePath := config.VSIUserDataFile userDataString := config.VSIUserDataString if userDataFilePath != "" { - content, err := ioutil.ReadFile(userDataFilePath) + content, err := os.ReadFile(userDataFilePath) if err != nil { err := fmt.Errorf("[ERROR] Error reading user data file. Error: %s", err) state.Put("error", err) @@ -177,7 +177,7 @@ func (step *stepCreateInstance) Run(_ context.Context, state multistep.StateBag) userDataFilePath := config.VSIUserDataFile userDataString := config.VSIUserDataString if userDataFilePath != "" { - content, err := ioutil.ReadFile(userDataFilePath) + content, err := os.ReadFile(userDataFilePath) if err != nil { err := fmt.Errorf("[ERROR] Error reading user data file. Error: %s", err) state.Put("error", err) @@ -244,7 +244,7 @@ func (step *stepCreateInstance) Run(_ context.Context, state multistep.StateBag) userDataFilePath := config.VSIUserDataFile userDataString := config.VSIUserDataString if userDataFilePath != "" { - content, err := ioutil.ReadFile(userDataFilePath) + content, err := os.ReadFile(userDataFilePath) if err != nil { err := fmt.Errorf("[ERROR] Error reading user data file. Error: %s", err) state.Put("error", err) @@ -318,7 +318,7 @@ func (step *stepCreateInstance) Run(_ context.Context, state multistep.StateBag) userDataFilePath := config.VSIUserDataFile userDataString := config.VSIUserDataString if userDataFilePath != "" { - content, err := ioutil.ReadFile(userDataFilePath) + content, err := os.ReadFile(userDataFilePath) if err != nil { err := fmt.Errorf("[ERROR] Error reading user data file. Error: %s", err) state.Put("error", err) @@ -370,7 +370,7 @@ func (step *stepCreateInstance) Cleanup(state multistep.StateBag) { // Delete Floating IP if it was created (VSI Interface was set as public) if config.VSIInterface == "public" { - if state.Get("floating_ip") != nil { + if state.Get("floating_ip") != nil && state.Get("floating_ip_id") != nil { floatingIP := state.Get("floating_ip").(string) ui.Say(fmt.Sprintf("Releasing the Floating IP: %s ...", floatingIP)) @@ -385,80 +385,93 @@ func (step *stepCreateInstance) Cleanup(state multistep.StateBag) { // log.Fatalf(err.Error()) return } - status := floatingIPresponse.Status - if *status == "available" { - options := vpcService.NewDeleteFloatingIPOptions(floatingIPID) - result, err := vpcService.DeleteFloatingIP(options) - - if err != nil { - err := fmt.Errorf("[ERROR] Error releasing the Floating IP. Please release it manually: %s", err) - state.Put("error", err) - ui.Error(err.Error()) - // log.Fatalf(err.Error()) - return - } - if result.StatusCode == 204 { - ui.Say("The Floating IP was successfully released!") + // Only proceed if the Floating IP still exists (not 404) + if response.StatusCode != 404 && floatingIPresponse.Status != nil { + status := floatingIPresponse.Status + if *status == "available" { + options := vpcService.NewDeleteFloatingIPOptions(floatingIPID) + result, err := vpcService.DeleteFloatingIP(options) + + if err != nil { + err := fmt.Errorf("[ERROR] Error releasing the Floating IP. Please release it manually: %s", err) + state.Put("error", err) + ui.Error(err.Error()) + // log.Fatalf(err.Error()) + return + } + if result.StatusCode == 204 { + ui.Say("The Floating IP was successfully released!") + } } + } else if response.StatusCode == 404 { + ui.Say("The Floating IP was already deleted or does not exist.") } } } // Wait a couple of seconds before attempting to delete the instance. time.Sleep(2 * time.Second) - instanceData := state.Get("instance_data").(*vpcv1.Instance) - instanceID := *instanceData.ID - ui.Say(fmt.Sprintf("Deleting Instance ID: %s ...", instanceID)) - - options := &vpcv1.DeleteInstanceOptions{} - options.SetID(instanceID) - _, err := vpcService.DeleteInstance(options) - - if err != nil { - err := fmt.Errorf("[ERROR] Error deleting the instance. Please delete it manually: %s", err) - state.Put("error", err) - ui.Error(err.Error()) - // log.Fatalf(err.Error()) - return - } - instanceDeleted := false - for !instanceDeleted { - options := &vpcv1.GetInstanceOptions{} + + // Check if instance_data exists in state before attempting deletion + if state.Get("instance_data") != nil { + instanceData := state.Get("instance_data").(*vpcv1.Instance) + instanceID := *instanceData.ID + ui.Say(fmt.Sprintf("Deleting Instance ID: %s ...", instanceID)) + + options := &vpcv1.DeleteInstanceOptions{} options.SetID(instanceID) - instance, response, err := vpcService.GetInstance(options) + _, err := vpcService.DeleteInstance(options) + if err != nil { - if response != nil && response.StatusCode == 404 { - ui.Say("Instance deleted Succesfully") - instanceDeleted = true - break - } - err := fmt.Errorf("[ERROR] Error getting the instance to check delete status. %s", err) + err := fmt.Errorf("[ERROR] Error deleting the instance. Please delete it manually: %s", err) state.Put("error", err) ui.Error(err.Error()) - } else if instance != nil { - ui.Say(fmt.Sprintf("Instance status :- %s", *instance.Status)) + // log.Fatalf(err.Error()) + return + } + instanceDeleted := false + for !instanceDeleted { + options := &vpcv1.GetInstanceOptions{} + options.SetID(instanceID) + instance, response, err := vpcService.GetInstance(options) + if err != nil { + if response != nil && response.StatusCode == 404 { + ui.Say("Instance deleted Successfully") + instanceDeleted = true + break + } + err := fmt.Errorf("[ERROR] Error getting the instance to check delete status. %s", err) + state.Put("error", err) + ui.Error(err.Error()) + } else if instance != nil { + ui.Say(fmt.Sprintf("Instance status :- %s", *instance.Status)) + } + time.Sleep(10 * time.Second) } - time.Sleep(10 * time.Second) } // Deleting Security Group's rule - if state.Get("security_group_rule_id") != nil { + if state.Get("security_group_rule_id") != nil && state.Get("security_group_id") != nil { ruleID := state.Get("security_group_rule_id").(string) + securityGroupID := state.Get("security_group_id").(string) ui.Say(fmt.Sprintf("Deleting Security Group's rule %s ...", ruleID)) sgRuleOptions := &vpcv1.DeleteSecurityGroupRuleOptions{} - sgRuleOptions.SetSecurityGroupID(state.Get("security_group_id").(string)) + sgRuleOptions.SetSecurityGroupID(securityGroupID) sgRuleOptions.SetID(ruleID) sgRuleResponse, sgRuleErr := vpcService.DeleteSecurityGroupRule(sgRuleOptions) if sgRuleErr != nil { - sgRuleErr := fmt.Errorf("[ERROR] Error deleting Security Group's rule %s. Please delete it manually: %s", ruleID, sgRuleErr) - state.Put("error", sgRuleErr) - ui.Error(err.Error()) - // log.Fatalf(err.Error()) - return - } - - if sgRuleResponse.StatusCode == 204 { + // Check if it's a 404 (resource already deleted) + if sgRuleResponse != nil && sgRuleResponse.StatusCode == 404 { + ui.Say("The Security Group's rule was already deleted or does not exist.") + } else { + sgRuleErr := fmt.Errorf("[ERROR] Error deleting Security Group's rule %s. Please delete it manually: %s", ruleID, sgRuleErr) + state.Put("error", sgRuleErr) + ui.Error(sgRuleErr.Error()) + // log.Fatalf(err.Error()) + return + } + } else if sgRuleResponse.StatusCode == 204 { ui.Say("The Security Group's rule was successfully deleted!") } } @@ -466,24 +479,27 @@ func (step *stepCreateInstance) Cleanup(state multistep.StateBag) { // Wait a couple of seconds before attempting to delete the security group. time.Sleep(10 * time.Second) - // Deleting Security Group + // Deleting Security Group (only if we created it, not if user provided one) if config.SecurityGroupID == "" { - if state.Get("security_group_name") != nil { + if state.Get("security_group_name") != nil && state.Get("security_group_id") != nil { securityGroupName := state.Get("security_group_name").(string) - ui.Say(fmt.Sprintf("Deleting Security Group %s ...", securityGroupName)) securityGroupID := state.Get("security_group_id").(string) + ui.Say(fmt.Sprintf("Deleting Security Group %s ...", securityGroupName)) sgOptions := &vpcv1.DeleteSecurityGroupOptions{} sgOptions.SetID(securityGroupID) sgResponse, err := vpcService.DeleteSecurityGroup(sgOptions) if err != nil { - err := fmt.Errorf("[ERROR] Error deleting Security Group %s. Please delete it manually: %s", securityGroupName, err) - state.Put("error", err) - ui.Error(err.Error()) - // log.Fatalf(err.Error()) - return - } - - if sgResponse.StatusCode == 204 { + // Check if it's a 404 (resource already deleted) + if sgResponse != nil && sgResponse.StatusCode == 404 { + ui.Say("The Security Group was already deleted or does not exist.") + } else { + err := fmt.Errorf("[ERROR] Error deleting Security Group %s. Please delete it manually: %s", securityGroupName, err) + state.Put("error", err) + ui.Error(err.Error()) + // log.Fatalf(err.Error()) + return + } + } else if sgResponse.StatusCode == 204 { ui.Say("The Security Group was successfully deleted!") } } diff --git a/builder/ibmcloud/vpc/step_create_ssh_key_pair.go b/builder/ibmcloud/vpc/step_create_ssh_key_pair.go index 7ca1ea1e..797b157e 100644 --- a/builder/ibmcloud/vpc/step_create_ssh_key_pair.go +++ b/builder/ibmcloud/vpc/step_create_ssh_key_pair.go @@ -8,7 +8,6 @@ import ( "crypto/x509" "encoding/pem" "fmt" - "io/ioutil" mathrand "math/rand" "os" "strconv" @@ -58,14 +57,14 @@ func (s *stepCreateSshKeyPair) Run(_ context.Context, state multistep.StateBag) privatefilepath = keysDirectory + "id_ed25519" publicfilepath = keysDirectory + "id_ed25519.pub" - err := ioutil.WriteFile(privatefilepath, privateKey, 0600) + err := os.WriteFile(privatefilepath, privateKey, 0600) if err != nil { err := fmt.Errorf("[ERROR] Failed to edit ed25519 private SSH Key's permission: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt } - err = ioutil.WriteFile(publicfilepath, authorizedKey, 0644) + err = os.WriteFile(publicfilepath, authorizedKey, 0644) if err != nil { err := fmt.Errorf("[ERROR] Failed to write ed25519 public SSH Key to file: %s", err) state.Put("error", err) @@ -100,7 +99,7 @@ func (s *stepCreateSshKeyPair) Run(_ context.Context, state multistep.StateBag) ui.Say(fmt.Sprintf("Writing Private SSH Key to a file %s", privatefilepath)) privatekey := string(pem.EncodeToMemory(&privBlk)) privateKey := []byte(fmt.Sprintf("%s\n", privatekey)) - err = ioutil.WriteFile(privatefilepath, privateKey, 0600) + err = os.WriteFile(privatefilepath, privateKey, 0600) if err != nil { err := fmt.Errorf("[ERROR] Failed to write Private SSH Key to file: %s", err) state.Put("error", err) @@ -131,7 +130,7 @@ func (s *stepCreateSshKeyPair) Run(_ context.Context, state multistep.StateBag) ui.Say(fmt.Sprintf("Writing Public SSH Key to a file %s", publicfilepath)) pubkey := string(publicKey) pubKey := []byte(fmt.Sprintf("%s\n", pubkey)) - err = ioutil.WriteFile(publicfilepath, pubKey, 0600) + err = os.WriteFile(publicfilepath, pubKey, 0600) if err != nil { err := fmt.Errorf("[ERROR] Failed to write Public SSH Key to file: %s", err) state.Put("error", err) diff --git a/builder/ibmcloud/vpc/step_create_ssh_key_vpc.go b/builder/ibmcloud/vpc/step_create_ssh_key_vpc.go index 0536d785..2eba3b5e 100644 --- a/builder/ibmcloud/vpc/step_create_ssh_key_vpc.go +++ b/builder/ibmcloud/vpc/step_create_ssh_key_vpc.go @@ -41,7 +41,15 @@ func (s *stepCreateSshKeyVPC) Run(_ context.Context, state multistep.StateBag) m func (s *stepCreateSshKeyVPC) Cleanup(state multistep.StateBag) { ui := state.Get("ui").(packer.Ui) - ui.Say(fmt.Sprintf("Deleting SSH key for VPC %s ...", state.Get("vpc_ssh_key_name").(string))) + // Check if VPC SSH key exists in state before attempting deletion + if state.Get("vpc_ssh_key_name") == nil || state.Get("vpc_ssh_key_id") == nil { + return + } + + vpcSSHKeyName := state.Get("vpc_ssh_key_name").(string) + vpcSSHKeyID := state.Get("vpc_ssh_key_id").(string) + + ui.Say(fmt.Sprintf("Deleting SSH key for VPC %s ...", vpcSSHKeyName)) // Wait half minute before deleting SSH key - otherwise wouldn't be deleted. time.Sleep(30 * time.Second) var vpcService *vpcv1.VpcV1 @@ -49,17 +57,21 @@ func (s *stepCreateSshKeyVPC) Cleanup(state multistep.StateBag) { vpcService = state.Get("vpcService").(*vpcv1.VpcV1) } deleteKeyOptions := &vpcv1.DeleteKeyOptions{} - deleteKeyOptions.SetID(state.Get("vpc_ssh_key_id").(string)) + deleteKeyOptions.SetID(vpcSSHKeyID) response, err := vpcService.DeleteKey(deleteKeyOptions) if err != nil { - err := fmt.Errorf("[ERROR] Error deleting SSH key for VPC %s. Please delete it manually: %s", state.Get("vpc_ssh_key_name").(string), err) - state.Put("error", err) - ui.Error(err.Error()) - // log.Fatalf(err.Error()) - return - } - if response.StatusCode == 204 { + // Check if it's a 404 (resource already deleted) + if response != nil && response.StatusCode == 404 { + ui.Say("The SSH key was already deleted or does not exist.") + } else { + err := fmt.Errorf("[ERROR] Error deleting SSH key for VPC %s. Please delete it manually: %s", vpcSSHKeyName, err) + state.Put("error", err) + ui.Error(err.Error()) + // log.Fatalf(err.Error()) + return + } + } else if response.StatusCode == 204 { ui.Say("The Key was successfully deleted!") } else { ui.Say("The key could not be deleted. Please delete it manually!") diff --git a/builder/ibmcloud/vpc/step_get_ip.go b/builder/ibmcloud/vpc/step_get_ip.go index b4b16b27..147eb724 100644 --- a/builder/ibmcloud/vpc/step_get_ip.go +++ b/builder/ibmcloud/vpc/step_get_ip.go @@ -3,7 +3,6 @@ package vpc import ( "context" "fmt" - "io/ioutil" "os" "github.com/IBM/vpc-go-sdk/vpcv1" @@ -78,7 +77,7 @@ func (step *stepGetIP) Run(_ context.Context, state multistep.StateBag) multiste } ipAddressBytes := []byte(fmt.Sprintf("%s\n", ipAddress)) - err := ioutil.WriteFile(hostsFilePath, ipAddressBytes, 0644) + err := os.WriteFile(hostsFilePath, ipAddressBytes, 0644) if err != nil { err := fmt.Errorf("[ERROR] Failed to write IP address to file: %s", err) state.Put("error", err) diff --git a/builder/ibmcloud/vpc/step_waitfor_instance.go b/builder/ibmcloud/vpc/step_waitfor_instance.go index 6811d0f7..556f89d6 100644 --- a/builder/ibmcloud/vpc/step_waitfor_instance.go +++ b/builder/ibmcloud/vpc/step_waitfor_instance.go @@ -3,7 +3,6 @@ package vpc import ( "context" "fmt" - "time" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/packer-plugin-sdk/multistep" @@ -36,127 +35,7 @@ func (s *stepWaitforInstance) Run(_ context.Context, state multistep.StateBag) m return multistep.ActionContinue } -func (client *stepWaitforInstance) Cleanup(state multistep.StateBag) { - config := state.Get("config").(Config) - ui := state.Get("ui").(packer.Ui) - var vpcService *vpcv1.VpcV1 - if state.Get("vpcService") != nil { - vpcService = state.Get("vpcService").(*vpcv1.VpcV1) - } - - // Delete Floating IP if it was created (VSI Interface was set as public) - if config.VSIInterface == "public" { - floatingIP := state.Get("floating_ip").(string) - ui.Say(fmt.Sprintf("Releasing the Floating IP: %s ...", floatingIP)) - - floatingIPID := state.Get("floating_ip_id").(string) - - options := vpcService.NewGetFloatingIPOptions(floatingIPID) - floatingIPresponse, response, err := vpcService.GetFloatingIP(options) - if err != nil && response.StatusCode != 404 { - err := fmt.Errorf("[ERROR] Error getting the Floating IP: %s", err) - state.Put("error", err) - ui.Error(err.Error()) - // log.Fatalf(err.Error()) - return - } - status := floatingIPresponse.Status - if *status == "available" { - options := vpcService.NewDeleteFloatingIPOptions(floatingIPID) - result, err := vpcService.DeleteFloatingIP(options) - - if err != nil { - err := fmt.Errorf("[ERROR] Error releasing the Floating IP. Please release it manually: %s", err) - state.Put("error", err) - ui.Error(err.Error()) - // log.Fatalf(err.Error()) - return - } - if result.StatusCode == 204 { - ui.Say("The Floating IP was successfully released!") - } - } - } - - // Wait a couple of seconds before attempting to delete the instance. - time.Sleep(2 * time.Second) - instanceData := state.Get("instance_data").(*vpcv1.Instance) - instanceID := *instanceData.ID - ui.Say(fmt.Sprintf("Deleting Instance ID: %s ...", instanceID)) - - options := &vpcv1.DeleteInstanceOptions{} - options.SetID(instanceID) - _, err := vpcService.DeleteInstance(options) - - if err != nil { - err := fmt.Errorf("[ERROR] Error deleting the instance. Please delete it manually: %s", err) - state.Put("error", err) - ui.Error(err.Error()) - // log.Fatalf(err.Error()) - return - } - instanceDeleted := false - for !instanceDeleted { - options := &vpcv1.GetInstanceOptions{} - options.SetID(instanceID) - instance, response, err := vpcService.GetInstance(options) - if err != nil { - if response != nil && response.StatusCode == 404 { - ui.Say("Instance deleted Succesfully") - instanceDeleted = true - break - } - err := fmt.Errorf("[ERROR] Error getting the instance to check delete status. %s", err) - state.Put("error", err) - ui.Error(err.Error()) - } else if instance != nil { - ui.Say(fmt.Sprintf("Instance status :- %s", *instance.Status)) - } - time.Sleep(10 * time.Second) - } - - // Deleting Security Group's rule - - ruleID := state.Get("security_group_rule_id").(string) - ui.Say(fmt.Sprintf("Deleting Security Group's rule %s ...", ruleID)) - sgRuleOptions := &vpcv1.DeleteSecurityGroupRuleOptions{} - sgRuleOptions.SetSecurityGroupID(state.Get("security_group_id").(string)) - sgRuleOptions.SetID(ruleID) - sgRuleResponse, sgRuleErr := vpcService.DeleteSecurityGroupRule(sgRuleOptions) - - if sgRuleErr != nil { - sgRuleErr := fmt.Errorf("[ERROR] Error deleting Security Group's rule %s. Please delete it manually: %s", ruleID, sgRuleErr) - state.Put("error", sgRuleErr) - ui.Error(err.Error()) - // log.Fatalf(err.Error()) - return - } - - if sgRuleResponse.StatusCode == 204 { - ui.Say("The Security Group's rule was successfully deleted!") - } - - // Wait a couple of seconds before attempting to delete the security group. - time.Sleep(10 * time.Second) - - // Deleting Security Group - if config.SecurityGroupID == "" { - securityGroupName := state.Get("security_group_name").(string) - ui.Say(fmt.Sprintf("Deleting Security Group %s ...", securityGroupName)) - securityGroupID := state.Get("security_group_id").(string) - sgOptions := &vpcv1.DeleteSecurityGroupOptions{} - sgOptions.SetID(securityGroupID) - sgResponse, err := vpcService.DeleteSecurityGroup(sgOptions) - if err != nil { - err := fmt.Errorf("[ERROR] Error deleting Security Group %s. Please delete it manually: %s", securityGroupName, err) - state.Put("error", err) - ui.Error(err.Error()) - // log.Fatalf(err.Error()) - return - } - - if sgResponse.StatusCode == 204 { - ui.Say("The Security Group was successfully deleted!") - } - } +// Cleanup is empty for this step. +func (s *stepWaitforInstance) Cleanup(state multistep.StateBag) { + // No cleanup needed here, stepCreateInstance handles all resource deletion } From d49d2eb2999f0f2454962bd8e1dd66dc08d4e762 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 15 Dec 2025 13:29:11 +0530 Subject: [PATCH 2/3] updated version Signed-off-by: Ujjwal Kumar --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index 0dc72ae8..8ef4e76f 100644 --- a/version/version.go +++ b/version/version.go @@ -8,7 +8,7 @@ var IBMCloudPluginVersion *version.PluginVersion var ( // Version is the main version number that is being run at the moment. - Version = "v3.3.3" + Version = "v3.3.4" VersionPrerelease = "dev" ) From f625c61d14d9bd686fd128e668349163c08c2f06 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 15 Dec 2025 13:29:51 +0530 Subject: [PATCH 3/3] updated go.mod Signed-off-by: Ujjwal Kumar --- go.mod | 16 ++++++++++------ go.sum | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 7322cab0..cf54b134 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module packer-plugin-ibmcloud -go 1.23.0 +go 1.24.0 toolchain go1.24.1 @@ -11,7 +11,7 @@ require ( github.com/hashicorp/hcl/v2 v2.14.1 github.com/hashicorp/packer-plugin-sdk v0.2.9 github.com/zclconf/go-cty v1.9.1 - golang.org/x/crypto v0.36.0 + golang.org/x/crypto v0.46.0 ) require ( @@ -21,6 +21,7 @@ require ( github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/armon/go-metrics v0.3.9 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/aws/aws-sdk-go v1.40.34 // indirect @@ -87,12 +88,15 @@ require ( github.com/ulikunitz/xz v0.5.10 // indirect go.mongodb.org/mongo-driver v1.17.2 // indirect go.opencensus.io v0.23.0 // indirect - golang.org/x/net v0.37.0 // indirect + golang.org/x/mod v0.30.0 // indirect + golang.org/x/net v0.47.0 // indirect golang.org/x/oauth2 v0.27.0 // indirect - golang.org/x/sys v0.31.0 // indirect - golang.org/x/term v0.30.0 // indirect - golang.org/x/text v0.23.0 // indirect + golang.org/x/sync v0.19.0 // indirect + golang.org/x/sys v0.39.0 // indirect + golang.org/x/term v0.38.0 // indirect + golang.org/x/text v0.32.0 // indirect golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect + golang.org/x/tools v0.39.0 // indirect google.golang.org/api v0.56.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2 // indirect diff --git a/go.sum b/go.sum index 2a24c915..c954f7ba 100644 --- a/go.sum +++ b/go.sum @@ -80,6 +80,8 @@ github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 h1:ZSTrOEhi github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-metrics v0.3.0/go.mod h1:zXjbSimjXTd7vOpY8B0/2LpvNvDoXBuplAD+gJD3GYs= @@ -357,6 +359,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl/v2 v2.14.1 h1:x0BpjfZ+CYdbiz+8yZTQ+gdLO7IXvOut7Da+XJayx34= github.com/hashicorp/hcl/v2 v2.14.1/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= +github.com/hashicorp/hcl/v2 v2.24.0 h1:2QJdZ454DSsYGoaE6QheQZjtKZSUs9Nh2izTWiwQxvE= +github.com/hashicorp/hcl/v2 v2.24.0/go.mod h1:oGoO1FIQYfn/AgyOhlg9qLC6/nOJPX3qGbkZpYAcqfM= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= github.com/hashicorp/memberlist v0.2.2 h1:5+RffWKwqJ71YPu9mWsF7ZOscZmwfasdA8kbdC7AO2g= @@ -572,6 +576,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zclconf/go-cty v1.9.1 h1:viqrgQwFl5UpSxc046qblj78wZXVDFnSOufaOTER+cc= github.com/zclconf/go-cty v1.9.1/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= +github.com/zclconf/go-cty v1.16.3 h1:osr++gw2T61A8KVYHoQiFbFd1Lh3JOCXc/jFLJXKTxk= +github.com/zclconf/go-cty v1.16.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.mongodb.org/mongo-driver v1.17.2 h1:gvZyk8352qSfzyZ2UMWcpDpMSGEr1eqE4T793SqyhzM= go.mongodb.org/mongo-driver v1.17.2/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -599,6 +605,9 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= +golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -634,6 +643,9 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -681,6 +693,7 @@ golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -711,6 +724,9 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -780,9 +796,14 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= +golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= +golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= +golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -793,6 +814,10 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= +golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -855,6 +880,9 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=