hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.77k stars 9.13k forks source link

[Bug]: data/aws_ssm_parameter within a module error couldn't find resource when created elsewhere in same plan #39660

Open jufemaiz opened 3 hours ago

jufemaiz commented 3 hours ago

Terraform Core Version

1.9.7

AWS Provider Version

5.70.0

Affected Resource(s)

aws_ssm_parameter

Expected Behavior

https://gist.github.com/jufemaiz/96d8ab9b7ab7d0988c2a30b17a66c872

The module's data aws_ssm_parameter should not attempt to discover the resource while it has not been created in main.tf.

Actual Behavior

Error is thrown:

$ terraform apply
module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter: Reading...

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create
 <= read (data resources)

Terraform planned the following actions, but then encountered a problem:

  # data.aws_ssm_parameter.path_to_a_parameter will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "aws_ssm_parameter" "path_to_a_parameter" {
      + arn            = (known after apply)
      + id             = (known after apply)
      + insecure_value = (known after apply)
      + name           = "/path/to/a/parameter"
      + type           = (known after apply)
      + value          = (sensitive value)
      + version        = (known after apply)
    }

  # aws_ssm_parameter.path_to_a_parameter will be created
  + resource "aws_ssm_parameter" "path_to_a_parameter" {
      + arn            = (known after apply)
      + data_type      = (known after apply)
      + id             = (known after apply)
      + insecure_value = (known after apply)
      + key_id         = (known after apply)
      + name           = "/path/to/a/parameter"
      + tags_all       = (known after apply)
      + tier           = (known after apply)
      + type           = "String"
      + value          = (sensitive value)
      + version        = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + path_to_a_parameter_ssm_parameter_name = "/path/to/a/parameter"
╷
│ Error: reading SSM Parameter (/path/to/a/parameter): couldn't find resource
│
│   with module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter,
│   on module/main.tf line 1, in data "aws_ssm_parameter" "path_to_a_parameter":
│    1: data "aws_ssm_parameter" "path_to_a_parameter" {
│

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

https://gist.github.com/jufemaiz/96d8ab9b7ab7d0988c2a30b17a66c872

Steps to Reproduce

terraform plan

Debug Output

2024-10-10T15:14:23.293+1100 [INFO]  Terraform version: 1.9.7
2024-10-10T15:14:23.294+1100 [DEBUG] using github.com/hashicorp/go-tfe v1.58.0
2024-10-10T15:14:23.294+1100 [DEBUG] using github.com/hashicorp/hcl/v2 v2.20.0
2024-10-10T15:14:23.294+1100 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2024-10-10T15:14:23.294+1100 [DEBUG] using github.com/zclconf/go-cty v1.14.4
2024-10-10T15:14:23.294+1100 [INFO]  Go runtime version: go1.22.7
2024-10-10T15:14:23.294+1100 [INFO]  CLI args: []string{"terraform", "plan"}
2024-10-10T15:14:23.294+1100 [DEBUG] Attempting to open CLI config file: /Users/joel/.terraformrc
2024-10-10T15:14:23.294+1100 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2024-10-10T15:14:23.294+1100 [INFO]  Loading CLI configuration from /Users/joel/.terraform.d/credentials.tfrc.json
2024-10-10T15:14:23.295+1100 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2024-10-10T15:14:23.295+1100 [DEBUG] ignoring non-existing provider search directory /Users/joel/.terraform.d/plugins
2024-10-10T15:14:23.295+1100 [DEBUG] ignoring non-existing provider search directory /Users/joel/Library/Application Support/io.terraform/plugins
2024-10-10T15:14:23.295+1100 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2024-10-10T15:14:23.296+1100 [INFO]  CLI command args: []string{"plan"}
2024-10-10T15:14:24.379+1100 [DEBUG] checking for provisioner in "."
2024-10-10T15:14:24.391+1100 [DEBUG] checking for provisioner in "/usr/local/bin"
2024-10-10T15:14:24.392+1100 [INFO]  backend/local: starting Plan operation
2024-10-10T15:14:24.397+1100 [DEBUG] created provider logger: level=debug
2024-10-10T15:14:24.397+1100 [INFO]  provider: configuring client automatic mTLS
2024-10-10T15:14:24.415+1100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5 args=[".terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5"]
2024-10-10T15:14:24.511+1100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5 pid=92375
2024-10-10T15:14:24.511+1100 [DEBUG] provider: waiting for RPC address: plugin=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5
2024-10-10T15:14:24.968+1100 [INFO]  provider.terraform-provider-aws_v5.70.0_x5: configuring server automatic mTLS: timestamp="2024-10-10T15:14:24.967+1100"
2024-10-10T15:14:24.986+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: plugin address: address=/var/folders/9q/v1dfygx14czghp71cfmb68r00000gn/T/plugin951163265 network=unix timestamp="2024-10-10T15:14:24.986+1100"
2024-10-10T15:14:24.986+1100 [DEBUG] provider: using plugin: version=5
2024-10-10T15:14:26.486+1100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-10-10T15:14:26.515+1100 [INFO]  provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5 id=92375
2024-10-10T15:14:26.516+1100 [DEBUG] provider: plugin exited
2024-10-10T15:14:26.528+1100 [DEBUG] Building and walking validate graph
2024-10-10T15:14:26.529+1100 [DEBUG] ProviderTransformer: "aws_ssm_parameter.path_to_a_parameter" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2024-10-10T15:14:26.529+1100 [DEBUG] ProviderTransformer: "data.aws_ssm_parameter.path_to_a_parameter" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2024-10-10T15:14:26.529+1100 [DEBUG] ProviderTransformer: "module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2024-10-10T15:14:26.530+1100 [DEBUG] ReferenceTransformer: "output.path_to_a_parameter_ssm_parameter_name (expand)" references: [aws_ssm_parameter.path_to_a_parameter]
2024-10-10T15:14:26.530+1100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hashicorp/aws\"]" references: []
2024-10-10T15:14:26.530+1100 [DEBUG] ReferenceTransformer: "module.data_aws_ssm_parameter_path_to_a_parameter (expand)" references: []
2024-10-10T15:14:26.530+1100 [DEBUG] ReferenceTransformer: "module.data_aws_ssm_parameter_path_to_a_parameter (close)" references: []
2024-10-10T15:14:26.530+1100 [DEBUG] ReferenceTransformer: "aws_ssm_parameter.path_to_a_parameter" references: []
2024-10-10T15:14:26.531+1100 [DEBUG] ReferenceTransformer: "data.aws_ssm_parameter.path_to_a_parameter" references: [aws_ssm_parameter.path_to_a_parameter]
2024-10-10T15:14:26.531+1100 [DEBUG] ReferenceTransformer: "module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter" references: [module.data_aws_ssm_parameter_path_to_a_parameter.var.path_to_a_parameter_ssm_parameter_name (expand)]
2024-10-10T15:14:26.531+1100 [DEBUG] ReferenceTransformer: "module.data_aws_ssm_parameter_path_to_a_parameter.var.path_to_a_parameter_ssm_parameter_name (expand)" references: [aws_ssm_parameter.path_to_a_parameter]
2024-10-10T15:14:26.532+1100 [DEBUG] Starting graph walk: walkValidate
2024-10-10T15:14:26.533+1100 [DEBUG] created provider logger: level=debug
2024-10-10T15:14:26.533+1100 [INFO]  provider: configuring client automatic mTLS
2024-10-10T15:14:26.541+1100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5 args=[".terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5"]
2024-10-10T15:14:26.644+1100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5 pid=92380
2024-10-10T15:14:26.645+1100 [DEBUG] provider: waiting for RPC address: plugin=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5
2024-10-10T15:14:27.084+1100 [INFO]  provider.terraform-provider-aws_v5.70.0_x5: configuring server automatic mTLS: timestamp="2024-10-10T15:14:27.084+1100"
2024-10-10T15:14:27.101+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: plugin address: address=/var/folders/9q/v1dfygx14czghp71cfmb68r00000gn/T/plugin346586464 network=unix timestamp="2024-10-10T15:14:27.101+1100"
2024-10-10T15:14:27.101+1100 [DEBUG] provider: using plugin: version=5
2024-10-10T15:14:27.311+1100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-10-10T15:14:27.325+1100 [INFO]  provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5 id=92380
2024-10-10T15:14:27.325+1100 [DEBUG] provider: plugin exited
2024-10-10T15:14:27.325+1100 [INFO]  backend/local: plan calling Plan
2024-10-10T15:14:27.325+1100 [DEBUG] Building and walking plan graph for NormalMode
2024-10-10T15:14:27.326+1100 [DEBUG] ProviderTransformer: "aws_ssm_parameter.path_to_a_parameter (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2024-10-10T15:14:27.326+1100 [DEBUG] ProviderTransformer: "data.aws_ssm_parameter.path_to_a_parameter (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2024-10-10T15:14:27.326+1100 [DEBUG] ProviderTransformer: "module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2024-10-10T15:14:27.326+1100 [DEBUG] ReferenceTransformer: "output.path_to_a_parameter_ssm_parameter_name (expand)" references: [aws_ssm_parameter.path_to_a_parameter (expand)]
2024-10-10T15:14:27.326+1100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hashicorp/aws\"]" references: []
2024-10-10T15:14:27.326+1100 [DEBUG] ReferenceTransformer: "module.data_aws_ssm_parameter_path_to_a_parameter (expand)" references: []
2024-10-10T15:14:27.326+1100 [DEBUG] ReferenceTransformer: "module.data_aws_ssm_parameter_path_to_a_parameter (close)" references: []
2024-10-10T15:14:27.326+1100 [DEBUG] ReferenceTransformer: "aws_ssm_parameter.path_to_a_parameter (expand)" references: []
2024-10-10T15:14:27.326+1100 [DEBUG] ReferenceTransformer: "data.aws_ssm_parameter.path_to_a_parameter (expand)" references: [aws_ssm_parameter.path_to_a_parameter (expand)]
2024-10-10T15:14:27.326+1100 [DEBUG] ReferenceTransformer: "module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter (expand)" references: [module.data_aws_ssm_parameter_path_to_a_parameter.var.path_to_a_parameter_ssm_parameter_name (expand)]
2024-10-10T15:14:27.326+1100 [DEBUG] ReferenceTransformer: "module.data_aws_ssm_parameter_path_to_a_parameter.var.path_to_a_parameter_ssm_parameter_name (expand)" references: [aws_ssm_parameter.path_to_a_parameter (expand)]
2024-10-10T15:14:27.327+1100 [DEBUG] Starting graph walk: walkPlan
2024-10-10T15:14:27.327+1100 [DEBUG] created provider logger: level=debug
2024-10-10T15:14:27.327+1100 [INFO]  provider: configuring client automatic mTLS
2024-10-10T15:14:27.333+1100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5 args=[".terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5"]
2024-10-10T15:14:27.418+1100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5 pid=92382
2024-10-10T15:14:27.418+1100 [DEBUG] provider: waiting for RPC address: plugin=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5
2024-10-10T15:14:27.812+1100 [INFO]  provider.terraform-provider-aws_v5.70.0_x5: configuring server automatic mTLS: timestamp="2024-10-10T15:14:27.811+1100"
2024-10-10T15:14:27.829+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: plugin address: address=/var/folders/9q/v1dfygx14czghp71cfmb68r00000gn/T/plugin3470122384 network=unix timestamp="2024-10-10T15:14:27.828+1100"
2024-10-10T15:14:27.829+1100 [DEBUG] provider: using plugin: version=5
2024-10-10T15:14:28.038+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: Configuring Terraform AWS Provider: @module=aws @caller=github.com/hashicorp/terraform-provider-aws/internal/conns/config.go:144 tf_mux_provider="*schema.GRPCProviderServer" tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e tf_rpc=ConfigureProvider timestamp="2024-10-10T15:14:28.038+1100"
2024-10-10T15:14:28.038+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: Resolving credentials provider: tf_provider_addr=registry.terraform.io/hashicorp/aws tf_mux_provider="*schema.GRPCProviderServer" @module=aws.aws-base tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e tf_rpc=ConfigureProvider @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:47 timestamp="2024-10-10T15:14:28.038+1100"
2024-10-10T15:14:28.039+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: Loading configuration: @module=aws.aws-base @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:47 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e tf_rpc=ConfigureProvider tf_mux_provider="*schema.GRPCProviderServer" timestamp="2024-10-10T15:14:28.039+1100"
2024-10-10T15:14:28.042+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: [DEBUG] missing_context: A profile defined with name `preview` is ignored. For use within a shared configuration file, a non-default profile must have `profile ` prefixed to the profile name. tf_aws.sdk=aws-sdk-go-v2
2024-10-10T15:14:28.042+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: Retrieving credentials: @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:47 tf_mux_provider="*schema.GRPCProviderServer" tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e tf_rpc=ConfigureProvider @module=aws.aws-base timestamp="2024-10-10T15:14:28.042+1100"
2024-10-10T15:14:28.042+1100 [INFO]  provider.terraform-provider-aws_v5.70.0_x5: Retrieved credentials: @module=aws.aws-base tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:39 tf_aws.credentials_source=EnvConfigCredentials tf_mux_provider="*schema.GRPCProviderServer" tf_rpc=ConfigureProvider timestamp="2024-10-10T15:14:28.042+1100"
2024-10-10T15:14:28.042+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: Loading configuration: @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:47 tf_rpc=ConfigureProvider @module=aws.aws-base tf_mux_provider="*schema.GRPCProviderServer" tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e timestamp="2024-10-10T15:14:28.042+1100"
2024-10-10T15:14:28.043+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: [DEBUG] missing_context: A profile defined with name `preview` is ignored. For use within a shared configuration file, a non-default profile must have `profile ` prefixed to the profile name. tf_aws.sdk=aws-sdk-go-v2
2024-10-10T15:14:28.043+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: Creating AWS SDK v1 session: tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e tf_rpc=ConfigureProvider @caller=github.com/hashicorp/terraform-provider-aws/internal/conns/config.go:168 tf_mux_provider="*schema.GRPCProviderServer" @module=aws tf_provider_addr=registry.terraform.io/hashicorp/aws timestamp="2024-10-10T15:14:28.043+1100"
2024-10-10T15:14:28.047+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: Retrieving AWS account details: tf_mux_provider="*schema.GRPCProviderServer" tf_provider_addr=registry.terraform.io/hashicorp/aws @caller=github.com/hashicorp/terraform-provider-aws/internal/conns/config.go:183 @module=aws tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e tf_rpc=ConfigureProvider timestamp="2024-10-10T15:14:28.047+1100"
2024-10-10T15:14:28.047+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: Retrieving caller identity from STS: tf_mux_provider="*schema.GRPCProviderServer" @module=aws.aws-base tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e tf_rpc=ConfigureProvider @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:47 timestamp="2024-10-10T15:14:28.047+1100"
2024-10-10T15:14:28.048+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: HTTP Request Sent: http.request.header.amz_sdk_request="attempt=1; max=25" http.url=https://sts.ap-southeast-2.amazonaws.com/ tf_mux_provider="*schema.GRPCProviderServer" @module=aws.aws-base
  http.request.body=
  | Action=GetCallerIdentity&Version=2011-06-15
   @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:47 http.request_content_length=43 rpc.system=aws-api tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e net.peer.name=sts.ap-southeast-2.amazonaws.com aws.region=ap-southeast-2 http.request.header.content_type=application/x-www-form-urlencoded http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.9.7 (+https://www.terraform.io) terraform-provider-aws/5.70.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go-v2/1.31.0 os/macos lang/go#1.23.1 md/GOOS#darwin md/GOARCH#amd64 api/sts#1.31.3" tf_rpc=ConfigureProvider http.request.header.amz_sdk_invocation_id=f39eefd4-6d5c-4513-bef0-520b4104a110 http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************MDJC/20241010/ap-southeast-2/sts/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=*****" rpc.method=GetCallerIdentity tf_aws.sdk=aws-sdk-go-v2 http.method=POST tf_provider_addr=registry.terraform.io/hashicorp/aws http.request.header.x_amz_date=20241010T041428Z http.request.header.x_amz_security_token="*****" tf_aws.signing_region="" rpc.service=STS timestamp="2024-10-10T15:14:28.048+1100"
2024-10-10T15:14:28.156+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: HTTP Response Received: rpc.service=STS tf_aws.signing_region="" @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:47 aws.region=ap-southeast-2 http.response_content_length=454 tf_aws.sdk=aws-sdk-go-v2 http.response.header.content_type=text/xml http.response.header.date="Thu, 10 Oct 2024 04:14:27 GMT" http.status_code=200 rpc.method=GetCallerIdentity tf_mux_provider="*schema.GRPCProviderServer" http.duration=107
  http.response.body=
  | <GetCallerIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
  |   <GetCallerIdentityResult>
  |     <Arn>arn:aws:sts::372213875655:assumed-role/Superuser/1728532919576479000</Arn>
  |     <UserId>AROA*************LVHA:1728532919576479000</UserId>
  |     <Account>372213875655</Account>
  |   </GetCallerIdentityResult>
  |   <ResponseMetadata>
  |     <RequestId>48d0ee19-6841-4a72-803a-75b160bbb483</RequestId>
  |   </ResponseMetadata>
  | </GetCallerIdentityResponse>
   tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e tf_rpc=ConfigureProvider tf_provider_addr=registry.terraform.io/hashicorp/aws @module=aws.aws-base http.response.header.x_amzn_requestid=48d0ee19-6841-4a72-803a-75b160bbb483 rpc.system=aws-api timestamp="2024-10-10T15:14:28.156+1100"
2024-10-10T15:14:28.157+1100 [INFO]  provider.terraform-provider-aws_v5.70.0_x5: Retrieved caller identity from STS: tf_mux_provider="*schema.GRPCProviderServer" @module=aws.aws-base tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=c35e58c1-02b5-c3af-c68b-85a692f54c3e tf_rpc=ConfigureProvider @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:39 timestamp="2024-10-10T15:14:28.156+1100"
2024-10-10T15:14:28.158+1100 [DEBUG] Resource instance state not found for node "aws_ssm_parameter.path_to_a_parameter", instance aws_ssm_parameter.path_to_a_parameter
2024-10-10T15:14:28.158+1100 [DEBUG] ReferenceTransformer: "aws_ssm_parameter.path_to_a_parameter" references: []
2024-10-10T15:14:28.159+1100 [DEBUG] refresh: aws_ssm_parameter.path_to_a_parameter: no state, so not refreshing
2024-10-10T15:14:28.178+1100 [DEBUG] Resource instance state not found for node "data.aws_ssm_parameter.path_to_a_parameter", instance data.aws_ssm_parameter.path_to_a_parameter
2024-10-10T15:14:28.178+1100 [DEBUG] ReferenceTransformer: "data.aws_ssm_parameter.path_to_a_parameter" references: []
2024-10-10T15:14:28.179+1100 [DEBUG] Resource instance state not found for node "module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter", instance module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter
2024-10-10T15:14:28.179+1100 [DEBUG] ReferenceTransformer: "module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter" references: []
module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter: Reading...
2024-10-10T15:14:28.184+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: HTTP Request Sent: @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:45 @module=aws http.method=POST http.request.header.x_amz_date=20241010T041428Z http.url=https://ssm.ap-southeast-2.amazonaws.com/ http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.9.7 (+https://www.terraform.io) terraform-provider-aws/5.70.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go-v2/1.31.0 os/macos lang/go#1.23.1 md/GOOS#darwin md/GOARCH#amd64 api/ssm#1.54.3" tf_provider_addr=registry.terraform.io/hashicorp/aws http.request.header.content_type=application/x-amz-json-1.1 tf_aws.signing_region="" aws.region=ap-southeast-2
  http.request.body=
  | {"Name":"/path/to/a/parameter","WithDecryption":true}
   http.request.header.amz_sdk_request="attempt=1; max=25" tf_aws.sdk=aws-sdk-go-v2 tf_mux_provider="*schema.GRPCProviderServer" http.request.header.amz_sdk_invocation_id=eb78db42-df75-4414-9ed4-305eb891f416 rpc.method=GetParameter rpc.service=SSM tf_data_source_type=aws_ssm_parameter http.request.header.x_amz_target=AmazonSSM.GetParameter http.request_content_length=53 tf_req_id=6dad19fe-4f7d-79bc-d6fb-21510cf90e91 net.peer.name=ssm.ap-southeast-2.amazonaws.com rpc.system=aws-api http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************MDJC/20241010/ap-southeast-2/ssm/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-date;x-amz-security-token;x-amz-target, Signature=*****" http.request.header.x_amz_security_token="*****" tf_rpc=ReadDataSource timestamp="2024-10-10T15:14:28.183+1100"
2024-10-10T15:14:28.312+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: HTTP Response Received: http.response.header.date="Thu, 10 Oct 2024 04:14:28 GMT" http.status_code=400 tf_aws.sdk=aws-sdk-go-v2 tf_provider_addr=registry.terraform.io/hashicorp/aws @module=aws aws.region=ap-southeast-2
  http.response.body=
  | {"__type":"ParameterNotFound"}
   tf_aws.signing_region="" tf_data_source_type=aws_ssm_parameter @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:45 http.duration=127 rpc.method=GetParameter rpc.service=SSM tf_mux_provider="*schema.GRPCProviderServer" http.response.header.connection=keep-alive http.response.header.content_type=application/x-amz-json-1.1 http.response.header.server=Server http.response.header.x_amzn_requestid=90eefa47-3bd0-45ff-961e-46dd01965199 rpc.system=aws-api tf_req_id=6dad19fe-4f7d-79bc-d6fb-21510cf90e91 tf_rpc=ReadDataSource timestamp="2024-10-10T15:14:28.312+1100"
2024-10-10T15:14:28.312+1100 [DEBUG] provider.terraform-provider-aws_v5.70.0_x5: request failed with unretryable error https response error StatusCode: 400, RequestID: 90eefa47-3bd0-45ff-961e-46dd01965199, ParameterNotFound: : tf_data_source_type=aws_ssm_parameter tf_mux_provider="*schema.GRPCProviderServer" @module=aws rpc.method=GetParameter rpc.system=aws-api aws.region=ap-southeast-2 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=6dad19fe-4f7d-79bc-d6fb-21510cf90e91 tf_aws.sdk=aws-sdk-go-v2 rpc.service=SSM tf_rpc=ReadDataSource @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.58/logging/tf_logger.go:45 timestamp="2024-10-10T15:14:28.312+1100"
2024-10-10T15:14:28.313+1100 [ERROR] provider.terraform-provider-aws_v5.70.0_x5: Response contains error diagnostic: tf_data_source_type=aws_ssm_parameter tf_provider_addr=registry.terraform.io/hashicorp/aws @caller=github.com/hashicorp/terraform-plugin-go@v0.24.0/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto diagnostic_detail="" diagnostic_severity=ERROR diagnostic_summary="reading SSM Parameter (/path/to/a/parameter): couldn't find resource" tf_req_id=6dad19fe-4f7d-79bc-d6fb-21510cf90e91 tf_rpc=ReadDataSource tf_proto_version=5.6 timestamp="2024-10-10T15:14:28.312+1100"
2024-10-10T15:14:28.313+1100 [ERROR] vertex "module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter" error: reading SSM Parameter (/path/to/a/parameter): couldn't find resource
2024-10-10T15:14:28.313+1100 [ERROR] vertex "module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter (expand)" error: reading SSM Parameter (/path/to/a/parameter): couldn't find resource
2024-10-10T15:14:28.314+1100 [WARN]  Planning encountered errors, so plan is not applyable
2024-10-10T15:14:28.314+1100 [INFO]  backend/local: plan operation completed

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create
 <= read (data resources)

Terraform planned the following actions, but then encountered a problem:

  # data.aws_ssm_parameter.path_to_a_parameter will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "aws_ssm_parameter" "path_to_a_parameter" {
      + arn            = (known after apply)
      + id             = (known after apply)
      + insecure_value = (known after apply)
      + name           = "/path/to/a/parameter"
      + type           = (known after apply)
      + value          = (sensitive value)
      + version        = (known after apply)
    }

  # aws_ssm_parameter.path_to_a_parameter will be created
  + resource "aws_ssm_parameter" "path_to_a_parameter" {
      + arn            = (known after apply)
      + data_type      = (known after apply)
      + id             = (known after apply)
      + insecure_value = (known after apply)
      + key_id         = (known after apply)
      + name           = "/path/to/a/parameter"
      + tags_all       = (known after apply)
      + tier           = (known after apply)
      + type           = "String"
      + value          = (sensitive value)
      + version        = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + path_to_a_parameter_ssm_parameter_name = "/path/to/a/parameter"
╷
│ Error: reading SSM Parameter (/path/to/a/parameter): couldn't find resource
│
│   with module.data_aws_ssm_parameter_path_to_a_parameter.data.aws_ssm_parameter.path_to_a_parameter,
│   on module/main.tf line 1, in data "aws_ssm_parameter" "path_to_a_parameter":
│    1: data "aws_ssm_parameter" "path_to_a_parameter" {
│
╵
2024-10-10T15:14:28.510+1100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-10-10T15:14:28.529+1100 [INFO]  provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/hashicorp/aws/5.70.0/darwin_amd64/terraform-provider-aws_v5.70.0_x5 id=92382
2024-10-10T15:14:28.529+1100 [DEBUG] provider: plugin exited

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 3 hours ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue