Difference between revisions of "Terraform resource: aws iam access key"

From wikieduonline
Jump to navigation Jump to search
Line 14: Line 14:
  
 
  secret
 
  secret
  Secret access key. This attribute is not available for imported resources. Note that this will be written to the state file. If you use this, please protect your backend state file judiciously. Alternatively, you may supply a pgp_key instead, which will prevent the secret from being stored in plaintext, at the cost of preventing the use of the secret key in automation.
+
  Secret access key. This attribute is not available for imported resources. Note that this will be written to the state file. If you use this, please protect your backend state file judiciously. Alternatively, you may supply a [[pgp_key]] instead, which will prevent the secret from being stored in plaintext, at the cost of preventing the use of the secret key in automation.
  
 
  [[terraform state pull]] | [[jq]] '.resources[] | select(.type == "[[aws_iam_access_key]]") | .instances[0].attributes' <ref>https://stackoverflow.com/questions/59473690/how-to-extract-sensitive-output-variables-in-terraform</ref>
 
  [[terraform state pull]] | [[jq]] '.resources[] | select(.type == "[[aws_iam_access_key]]") | .instances[0].attributes' <ref>https://stackoverflow.com/questions/59473690/how-to-extract-sensitive-output-variables-in-terraform</ref>

Revision as of 10:05, 27 February 2023

Examples:

resource "aws_iam_access_key" "your_lb" {
  user    = aws_iam_user.lb.name
  pgp_key = "keybase:some_person_that_exists"
}
resource "aws_iam_access_key" "your_lb" {
  user    = aws_iam_user.lb.name
  secret[1] = XXX
}


secret
Secret access key. This attribute is not available for imported resources. Note that this will be written to the state file. If you use this, please protect your backend state file judiciously. Alternatively, you may supply a pgp_key instead, which will prevent the secret from being stored in plaintext, at the cost of preventing the use of the secret key in automation.
terraform state pull | jq '.resources[] | select(.type == "aws_iam_access_key") | .instances[0].attributes' [2]

Related

See also

  • https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_access_key#secret
  • https://stackoverflow.com/questions/59473690/how-to-extract-sensitive-output-variables-in-terraform
  • Advertising: