hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
41.74k stars 9.43k forks source link

terraform import aws_iam_role_policy issue with inline policy #24203

Closed martinklie closed 4 years ago

martinklie commented 4 years ago

Trying to import a role and inline policy. Able to import the role using the syntax below:

terraform import aws_iam_role.tw_guardduty_sechub_role tw_guardduty_sechub

The inline policy is another issue. The role above has an inline policy below and feel TF is sharing the error below since it cannot see the policy. Can we point me to syntax where I can import an inline policy please.

terraform import aws_iam_role_policy.tw_managesecurityhub role_of_tw_managesecurityhub:tw_managesecurityhub

Warning: Interpolation-only expressions are deprecated

on tw_guardduty_sechub_role.tf line 7, in provider "aws": 7: region = "${var.region}"

Terraform 0.11 and earlier required all non-constant expressions to be provided via interpolation syntax, but this pattern is now deprecated. To silence this warning, remove the "${ sequence from the start and the }" sequence from the end of this expression, leaving just the inner expression.

Template interpolation syntax is still used to construct strings from expressions when the template includes multiple interpolation sequences or a mixture of literal strings and interpolations. This deprecation applies only to templates that consist entirely of a single interpolation sequence.

(and 4 more similar warnings elsewhere)

Error: resource address "aws_iam_role_policy.tw_managesecurityhub" does not exist in the configuration.

Before importing this resource, please create its configuration in the root module. For example:

resource "aws_iam_role_policy" "tw_managesecurityhub" {

(resource arguments)

}

-bash-4.2$ terraform -version Terraform v0.12.20

ghost commented 4 years ago

This issue has been automatically migrated to terraform-providers/terraform-provider-aws#12162 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to terraform-providers/terraform-provider-aws#12162.

ghost commented 4 years ago

This issue has been automatically migrated to terraform-providers/terraform-provider-aws#12163 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to terraform-providers/terraform-provider-aws#12163.

ghost commented 4 years ago

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.