Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: string is required when create resource aws_default_vpc_dhcp_options #25581

Closed
rollcabbage opened this issue Jun 27, 2022 · 5 comments
Closed
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.

Comments

@rollcabbage
Copy link

rollcabbage commented Jun 27, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v1.2.3
on darwin_amd64

Affected Resource(s)

  • aws_default_vpc_dhcp_options

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

module "my_module" {
  source = "../../modules/platform/default_vpc"
}

module "default_vpc" {
  source = "trussworks/destroy-default-vpc/aws"
  region = "ap-northeast-1"
  azs    = ["a", "c", "d"]
}

Expected Behavior

terraform plan without error

Actual Behavior

Error: Failed to decode resource from state
Error decoding
"module.my_module.module.default_vpc.aws_default_vpc_dhcp_options.default"
from previous state: string is required
Error: string is required

Steps to Reproduce

  1. terraform plan

Important Factoids

Occurred after using v4.20.1

https://github.com/hashicorp/terraform-provider-aws/releases/tag/v4.20.1

issue #25562 also be experienced.

References

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/vpc Issues and PRs that pertain to the vpc service. labels Jun 27, 2022
@ewbankkit
Copy link
Contributor

@rollcabbage Thanks for raising this issue 👏.
Do you know which version of the Terraform AWS Provider was used to create the aws_default_vpc_dhcp_options resource that reports the string is required error?
Do you have access to the Terraform state file? If so, could you paste the attributes for the resources (sanitized if necessary)?
Thanks.

@ewbankkit ewbankkit added bug Addresses a defect in current functionality. waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Jun 27, 2022
@rollcabbage
Copy link
Author

@ewbankkit Thanks for your replay.

which version of the Terraform AWS Provider was used

I used v4.20.1

Below is my tfstate.

{
      "module": "module. my_module.module.default_vpc",
      "mode": "managed",
      "type": "aws_default_vpc_dhcp_options",
      "name": "default",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "arn": "arn:aws:ec2:ap-northeast-1:*********:dhcp-options/dopt-0789ca4a7049f9141",
            "domain_name": "ap-northeast-1.compute.internal",
            "domain_name_servers": [
              "AmazonProvidedDNS"
            ],
            "id": "dopt-0789ca4a7049f9141",
            "netbios_name_servers": [],
            "netbios_node_type": "",
            "ntp_servers": [],
            "owner_id": "***********",
            "tags": {
              "Automation": "terraform",
              "Name": "default"
            },
            "tags_all": {
              "Automation": "terraform",
              "Name": "default"
            }
          },
          "sensitive_attributes": [],
          "private": "bnVsbA==",
          "dependencies": [
            "module. my_module.module.default_vpc.aws_default_vpc.default"
          ]
        }
      ]
    },

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Jun 27, 2022
@ewbankkit
Copy link
Contributor

@rollcabbage Thanks for the response.
The error you experienced will be just for those aws_default_vpc_dhcp_options resources created with v4.20.0 of the Terraform Provider, before v4.20.1 was available.
Due to the short time window that this bug could have been caused in and the fact that deleting an aws_default_vpc_dhcp_options resource doesn't delete the underlying AWS DHCP Options Set, just removes the Terraform resource from state, please remove the affected resource (e.g. terraform destroy -target module.my_module.module.default_vpc.aws_default_vpc_dhcp_options.default) and then create it again with v4.20.1.

@ewbankkit ewbankkit added the waiting-response Maintainers are waiting on response from community or contributor. label Jun 28, 2022
@rollcabbage
Copy link
Author

@ewbankkit Thank you so much. I fixed this issue by your way.

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Jun 29, 2022
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.
Projects
None yet
Development

No branches or pull requests

2 participants