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.83k stars 9.19k forks source link

EC2 DLM DataLifecycle Manager - cannot set policy_type = IMAGE_MANAGEMENT #26193

Closed marcomoscatiello closed 9 months ago

marcomoscatiello commented 2 years ago

Community Note

Terraform CLI and Terraform AWS Provider Version

Terraform v1.2.2 on darwin_amd64

Affected Resource(s)

Terraform Configuration Files

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

#main.tf

resource "aws_dlm_lifecycle_policy" "development_servers" {
  description        = "TDA DevOps AMI backup policy for Development EC2 Servers"
  execution_role_arn = aws_iam_role.this.arn
  state              = "ENABLED"
  tags               = var.tags

  policy_details {
    resource_types = ["INSTANCE"]

    schedule {
      name = "${var.prefix}-${var.name}-development-daily-3days"
      create_rule {
        interval      = 24
        interval_unit = "HOURS"
        times         = ["23:00"]
      }
      retain_rule {
        count = 3
      }
      tags_to_add = var.tags
    }
    target_tags = {
      Backup-retention = "3days"
    }
  }
}

#iam.tf
resource "aws_iam_role" "this" {
  name               = "${var.prefix}-${var.name}"
  assume_role_policy = data.aws_iam_policy_document.assume_role_policy.json
}

data "aws_iam_policy_document" "assume_role_policy" {
  statement {
    actions = ["sts:AssumeRole"]

    principals {
      type        = "Service"
      identifiers = ["dlm.amazonaws.com"]
    }
  }
}

resource "aws_iam_role_policy_attachment" "iam_policy_attach" {
  role       = aws_iam_role.this.name
  policy_arn = "arn:aws:iam::aws:policy/service-role/AWSDataLifecycleManagerServiceRole"
}

#variables.tf
variable "prefix" {
  type        = string
  description = "the TUI TDA Department"
  default     = "tui-tda"
}

variable "name" {
  type        = string
  description = "The naim of the policy and function"
  default     = "dlm-ami-backup"
}

variable "tags" {
  type        = map(any)
  description = "Tags associated to the AMI backup"
  default     = {}
}

Debug Output

2022-08-09T17:48:08.175+0100 [INFO]  Terraform version: 1.2.2
2022-08-09T17:48:08.176+0100 [DEBUG] using github.com/hashicorp/go-tfe v1.0.0
2022-08-09T17:48:08.176+0100 [DEBUG] using github.com/hashicorp/hcl/v2 v2.12.0
2022-08-09T17:48:08.176+0100 [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2
2022-08-09T17:48:08.176+0100 [DEBUG] using github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734
2022-08-09T17:48:08.176+0100 [DEBUG] using github.com/zclconf/go-cty v1.10.0
2022-08-09T17:48:08.176+0100 [INFO]  Go runtime version: go1.18.2
2022-08-09T17:48:08.176+0100 [INFO]  CLI args: []string{"terraform", "apply"}
2022-08-09T17:48:08.176+0100 [DEBUG] Attempting to open CLI config file: /Users/marcomoscatiello/.terraformrc
2022-08-09T17:48:08.176+0100 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-08-09T17:48:08.176+0100 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2022-08-09T17:48:08.176+0100 [DEBUG] ignoring non-existing provider search directory /Users/marcomoscatiello/.terraform.d/plugins
2022-08-09T17:48:08.176+0100 [DEBUG] ignoring non-existing provider search directory /Users/marcomoscatiello/Library/Application Support/io.terraform/plugins
2022-08-09T17:48:08.176+0100 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2022-08-09T17:48:08.176+0100 [INFO]  CLI command args: []string{"apply"}
2022-08-09T17:48:08.180+0100 [INFO]  AWS Auth provider used: "EnvProvider"
2022-08-09T17:48:08.181+0100 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2022-08-09T17:48:08.181+0100 [DEBUG] [aws-sdk-go] DEBUG: Request sts/GetCallerIdentity Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: sts.amazonaws.com
User-Agent: APN/1.0 HashiCorp/1.0 Terraform/1.2.2 aws-sdk-go/1.42.35 (go1.18.2; darwin; amd64)
Content-Length: 43
Authorization: AWS4-HMAC-SHA256 Credential=ASIAW72MMS7JG3TJM4PM/20220809/us-east-1/sts/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=718f8e7d133b4eb4bfd925f7c97464e9e444a5c978a8226bfa2ec9499bfc08a1
Content-Type: application/x-www-form-urlencoded; charset=utf-8
X-Amz-Date: 20220809T164808Z
X-Amz-Security-Token: IQoJb3JpZ2luX2VjEMn//////////wEaCWV1LXdlc3QtMSJIMEYCIQDQGEoHRiAF8s7Sg2Lpu4y3Fb2JHK2vr0FenaMQ8fvqCQIhALrUr/S8SF4g10t8QogS8mfDzrKSzs6Ex0NjoEu9NlI/KqgCCDIQBBoMNDgwNjU5Njc1MDkwIgz1yhgEhfTS79ttwOkqhQJboB/3rK+0JILvzz0kXlgwY8IYQ/LHTJDI86SQ38Hj0vWElpDhyGD783aYFcLvl/gEu+GlCXwD+J8T2L1UkJdkNOXobTJ7RjswoiVMub+vzDNxrdUNRSbV8kA4QD++AZfPmfdyTD/N4bwZyFnSkInGQIns3MwuaiOiR+9iXe/bM5z+/cRB/Q6hWSesuwbMHCyh/MtBx1CTdKX1KwCzY2IJB7dI6RCzK1Dil3ehZrzxtcxm0Zpb7hzxC7EksihP4Zee+zNV9Mh/dWtqs2z918vUyvq/He1RwFpLc+rP/I215W7QveXHpAVMeEx9Po0avgwUvyxukNyiKEzCB5sZVh4XLAXdJuAwjZ/KlwY6nAHaywPzp1gwr1b6pSbFgXFTkdLuxgDXvMMm4MZ52peFuoi1ICrG9XaKLwoUT0vvgn32xDlh8IdhYC5ywzMEf2u4P1s7qFvWbl5dmm2Q/EvXgUKUSsHtR0qeNtxXjoRjICUDAIS4Np18weP94SFa5QlEgGqsvSXdEpqx4HnFsvn9y1HpU+Tp7fN2h+Gomys0a/yCtzM2cKq9EFOnDTU=
Accept-Encoding: gzip

Action=GetCallerIdentity&Version=2011-06-15
-----------------------------------------------------
2022-08-09T17:48:08.511+0100 [DEBUG] [aws-sdk-go] DEBUG: Response sts/GetCallerIdentity Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 474
Content-Type: text/xml
Date: Tue, 09 Aug 2022 16:48:08 GMT
X-Amzn-Requestid: b630817f-8078-473f-860a-3775b2ebaee2

-----------------------------------------------------
2022-08-09T17:48:08.511+0100 [DEBUG] [aws-sdk-go] <GetCallerIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
  <GetCallerIdentityResult>
    <Arn>arn:aws:sts::480659675090:assumed-role/account-admin/marco.moscatiello@tui.co.uk</Arn>
    <UserId>AROAW72MMS7JJVUR5TNJN:marco.moscatiello@tui.co.uk</UserId>
    <Account>480659675090</Account>
  </GetCallerIdentityResult>
  <ResponseMetadata>
    <RequestId>b630817f-8078-473f-860a-3775b2ebaee2</RequestId>
  </ResponseMetadata>
</GetCallerIdentityResponse>
2022-08-09T17:48:09.034+0100 [DEBUG] checking for provisioner in "."
2022-08-09T17:48:09.034+0100 [DEBUG] checking for provisioner in "/usr/local/bin"
2022-08-09T17:48:09.035+0100 [INFO]  backend/local: starting Apply operation
2022-08-09T17:48:09.035+0100 [DEBUG] [aws-sdk-go] DEBUG: Request s3/ListObjects Details:
---[ REQUEST POST-SIGN ]-----------------------------
GET /?max-keys=1000&prefix=env%3A%2F HTTP/1.1
Host: tui-tda-devops-terraform-state-480659675090.s3.eu-central-1.amazonaws.com
User-Agent: APN/1.0 HashiCorp/1.0 Terraform/1.2.2 aws-sdk-go/1.42.35 (go1.18.2; darwin; amd64)
Authorization: AWS4-HMAC-SHA256 Credential=ASIAW72MMS7JG3TJM4PM/20220809/eu-central-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=9524bc185a8e12a86a314a69200d1a1e9707e2d01178d6d8147b70b7787b0eb9
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20220809T164809Z
X-Amz-Security-Token: IQoJb3JpZ2luX2VjEMn//////////wEaCWV1LXdlc3QtMSJIMEYCIQDQGEoHRiAF8s7Sg2Lpu4y3Fb2JHK2vr0FenaMQ8fvqCQIhALrUr/S8SF4g10t8QogS8mfDzrKSzs6Ex0NjoEu9NlI/KqgCCDIQBBoMNDgwNjU5Njc1MDkwIgz1yhgEhfTS79ttwOkqhQJboB/3rK+0JILvzz0kXlgwY8IYQ/LHTJDI86SQ38Hj0vWElpDhyGD783aYFcLvl/gEu+GlCXwD+J8T2L1UkJdkNOXobTJ7RjswoiVMub+vzDNxrdUNRSbV8kA4QD++AZfPmfdyTD/N4bwZyFnSkInGQIns3MwuaiOiR+9iXe/bM5z+/cRB/Q6hWSesuwbMHCyh/MtBx1CTdKX1KwCzY2IJB7dI6RCzK1Dil3ehZrzxtcxm0Zpb7hzxC7EksihP4Zee+zNV9Mh/dWtqs2z918vUyvq/He1RwFpLc+rP/I215W7QveXHpAVMeEx9Po0avgwUvyxukNyiKEzCB5sZVh4XLAXdJuAwjZ/KlwY6nAHaywPzp1gwr1b6pSbFgXFTkdLuxgDXvMMm4MZ52peFuoi1ICrG9XaKLwoUT0vvgn32xDlh8IdhYC5ywzMEf2u4P1s7qFvWbl5dmm2Q/EvXgUKUSsHtR0qeNtxXjoRjICUDAIS4Np18weP94SFa5QlEgGqsvSXdEpqx4HnFsvn9y1HpU+Tp7fN2h+Gomys0a/yCtzM2cKq9EFOnDTU=
Accept-Encoding: gzip

-----------------------------------------------------
2022-08-09T17:48:09.159+0100 [DEBUG] [aws-sdk-go] DEBUG: Response s3/ListObjects Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Transfer-Encoding: chunked
Content-Type: application/xml
Date: Tue, 09 Aug 2022 16:48:10 GMT
Server: AmazonS3
X-Amz-Bucket-Region: eu-central-1
X-Amz-Id-2: sbOGV/qUjyJXmw9PvgTi486q653N5YHkz6Rh6i3VjBzBX0ahVzh2Y2MMPmzxoz5ksNypwrk97wA=
X-Amz-Request-Id: VAEKDNGDMDBWV8G6

-----------------------------------------------------
2022-08-09T17:48:09.159+0100 [DEBUG] [aws-sdk-go] <?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>tui-tda-devops-terraform-state-480659675090</Name><Prefix>env:/</Prefix><Marker></Marker><MaxKeys>1000</MaxKeys><IsTruncated>false</IsTruncated></ListBucketResult>
2022-08-09T17:48:09.160+0100 [DEBUG] [aws-sdk-go] DEBUG: Request dynamodb/PutItem Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: dynamodb.eu-central-1.amazonaws.com
User-Agent: APN/1.0 HashiCorp/1.0 Terraform/1.2.2 aws-sdk-go/1.42.35 (go1.18.2; darwin; amd64)
Content-Length: 501
Accept-Encoding: identity
Authorization: AWS4-HMAC-SHA256 Credential=ASIAW72MMS7JG3TJM4PM/20220809/eu-central-1/dynamodb/aws4_request, SignedHeaders=accept-encoding;content-length;content-type;host;x-amz-date;x-amz-security-token;x-amz-target, Signature=e356982d8313350e00b0081be33780f57e36f16c213148e33096ba96e5307d76
Content-Type: application/x-amz-json-1.0
X-Amz-Date: 20220809T164809Z
X-Amz-Security-Token: IQoJb3JpZ2luX2VjEMn//////////wEaCWV1LXdlc3QtMSJIMEYCIQDQGEoHRiAF8s7Sg2Lpu4y3Fb2JHK2vr0FenaMQ8fvqCQIhALrUr/S8SF4g10t8QogS8mfDzrKSzs6Ex0NjoEu9NlI/KqgCCDIQBBoMNDgwNjU5Njc1MDkwIgz1yhgEhfTS79ttwOkqhQJboB/3rK+0JILvzz0kXlgwY8IYQ/LHTJDI86SQ38Hj0vWElpDhyGD783aYFcLvl/gEu+GlCXwD+J8T2L1UkJdkNOXobTJ7RjswoiVMub+vzDNxrdUNRSbV8kA4QD++AZfPmfdyTD/N4bwZyFnSkInGQIns3MwuaiOiR+9iXe/bM5z+/cRB/Q6hWSesuwbMHCyh/MtBx1CTdKX1KwCzY2IJB7dI6RCzK1Dil3ehZrzxtcxm0Zpb7hzxC7EksihP4Zee+zNV9Mh/dWtqs2z918vUyvq/He1RwFpLc+rP/I215W7QveXHpAVMeEx9Po0avgwUvyxukNyiKEzCB5sZVh4XLAXdJuAwjZ/KlwY6nAHaywPzp1gwr1b6pSbFgXFTkdLuxgDXvMMm4MZ52peFuoi1ICrG9XaKLwoUT0vvgn32xDlh8IdhYC5ywzMEf2u4P1s7qFvWbl5dmm2Q/EvXgUKUSsHtR0qeNtxXjoRjICUDAIS4Np18weP94SFa5QlEgGqsvSXdEpqx4HnFsvn9y1HpU+Tp7fN2h+Gomys0a/yCtzM2cKq9EFOnDTU=
X-Amz-Target: DynamoDB_20120810.PutItem

{"ConditionExpression":"attribute_not_exists(LockID)","Item":{"Info":{"S":"{\"ID\":\"f22a6ac4-edb5-d651-23bc-dac14cda1bb1\",\"Operation\":\"OperationTypeApply\",\"Info\":\"\",\"Who\":\"marcomoscatiello@192.168.1.244\",\"Version\":\"1.2.2\",\"Created\":\"2022-08-09T16:48:09.159382Z\",\"Path\":\"tui-tda-devops-terraform-state-480659675090/dlm-ami-backup/terraform.tfstate\"}"},"LockID":{"S":"tui-tda-devops-terraform-state-480659675090/dlm-ami-backup/terraform.tfstate"}},"TableName":"terraform-lock"}
-----------------------------------------------------
2022-08-09T17:48:09.254+0100 [DEBUG] [aws-sdk-go] DEBUG: Response dynamodb/PutItem Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 2
Content-Type: application/x-amz-json-1.0
Date: Tue, 09 Aug 2022 16:48:09 GMT
Server: Server
X-Amz-Crc32: 2745614147
X-Amzn-Requestid: GDRF1NLC4VM9UC8QRJ0PUEPAR3VV4KQNSO5AEMVJF66Q9ASUAAJG

-----------------------------------------------------
2022-08-09T17:48:09.254+0100 [DEBUG] [aws-sdk-go] {}
2022-08-09T17:48:09.255+0100 [DEBUG] [aws-sdk-go] DEBUG: Request s3/GetObject Details:
---[ REQUEST POST-SIGN ]-----------------------------
GET /dlm-ami-backup/terraform.tfstate HTTP/1.1
Host: tui-tda-devops-terraform-state-480659675090.s3.eu-central-1.amazonaws.com
User-Agent: APN/1.0 HashiCorp/1.0 Terraform/1.2.2 aws-sdk-go/1.42.35 (go1.18.2; darwin; amd64)
Authorization: AWS4-HMAC-SHA256 Credential=ASIAW72MMS7JG3TJM4PM/20220809/eu-central-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=10afd3dee0504cd4c9aa58c87e96a282d2b4aad7cd4e9e15e17a7c2e675c7e95
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20220809T164809Z
X-Amz-Security-Token: IQoJb3JpZ2luX2VjEMn//////////wEaCWV1LXdlc3QtMSJIMEYCIQDQGEoHRiAF8s7Sg2Lpu4y3Fb2JHK2vr0FenaMQ8fvqCQIhALrUr/S8SF4g10t8QogS8mfDzrKSzs6Ex0NjoEu9NlI/KqgCCDIQBBoMNDgwNjU5Njc1MDkwIgz1yhgEhfTS79ttwOkqhQJboB/3rK+0JILvzz0kXlgwY8IYQ/LHTJDI86SQ38Hj0vWElpDhyGD783aYFcLvl/gEu+GlCXwD+J8T2L1UkJdkNOXobTJ7RjswoiVMub+vzDNxrdUNRSbV8kA4QD++AZfPmfdyTD/N4bwZyFnSkInGQIns3MwuaiOiR+9iXe/bM5z+/cRB/Q6hWSesuwbMHCyh/MtBx1CTdKX1KwCzY2IJB7dI6RCzK1Dil3ehZrzxtcxm0Zpb7hzxC7EksihP4Zee+zNV9Mh/dWtqs2z918vUyvq/He1RwFpLc+rP/I215W7QveXHpAVMeEx9Po0avgwUvyxukNyiKEzCB5sZVh4XLAXdJuAwjZ/KlwY6nAHaywPzp1gwr1b6pSbFgXFTkdLuxgDXvMMm4MZ52peFuoi1ICrG9XaKLwoUT0vvgn32xDlh8IdhYC5ywzMEf2u4P1s7qFvWbl5dmm2Q/EvXgUKUSsHtR0qeNtxXjoRjICUDAIS4Np18weP94SFa5QlEgGqsvSXdEpqx4HnFsvn9y1HpU+Tp7fN2h+Gomys0a/yCtzM2cKq9EFOnDTU=
Accept-Encoding: gzip

-----------------------------------------------------
2022-08-09T17:48:09.379+0100 [DEBUG] [aws-sdk-go] DEBUG: Response s3/GetObject Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 6160
Accept-Ranges: bytes
Content-Type: application/json
Date: Tue, 09 Aug 2022 16:48:10 GMT
Etag: "a46a8e5224e49073e5f2a9fe569a8e9f"
Last-Modified: Tue, 09 Aug 2022 16:47:37 GMT
Server: AmazonS3
X-Amz-Id-2: v7tYPvet4BBcpfSFv1r7eg5n67FwJpHAtcqDJbKQSP4b3myBXLm06hPkGRQFIIx8WGtSUxqiBP8=
X-Amz-Request-Id: VAEXHPS4T4HPA671
X-Amz-Server-Side-Encryption: AES256
X-Amz-Version-Id: xzKyN0fMym5GJJmEfiV5QPFXO055VoLZ

-----------------------------------------------------
2022-08-09T17:48:09.379+0100 [DEBUG] [aws-sdk-go]
2022-08-09T17:48:09.380+0100 [DEBUG] [aws-sdk-go] DEBUG: Request dynamodb/GetItem Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: dynamodb.eu-central-1.amazonaws.com
User-Agent: APN/1.0 HashiCorp/1.0 Terraform/1.2.2 aws-sdk-go/1.42.35 (go1.18.2; darwin; amd64)
Content-Length: 198
Accept-Encoding: identity
Authorization: AWS4-HMAC-SHA256 Credential=ASIAW72MMS7JG3TJM4PM/20220809/eu-central-1/dynamodb/aws4_request, SignedHeaders=accept-encoding;content-length;content-type;host;x-amz-date;x-amz-security-token;x-amz-target, Signature=3dddd9f6979a72096d545b86b20a2912258c6a35d4f28fdb637ef2d20834cae4
Content-Type: application/x-amz-json-1.0
X-Amz-Date: 20220809T164809Z
X-Amz-Security-Token: IQoJb3JpZ2luX2VjEMn//////////wEaCWV1LXdlc3QtMSJIMEYCIQDQGEoHRiAF8s7Sg2Lpu4y3Fb2JHK2vr0FenaMQ8fvqCQIhALrUr/S8SF4g10t8QogS8mfDzrKSzs6Ex0NjoEu9NlI/KqgCCDIQBBoMNDgwNjU5Njc1MDkwIgz1yhgEhfTS79ttwOkqhQJboB/3rK+0JILvzz0kXlgwY8IYQ/LHTJDI86SQ38Hj0vWElpDhyGD783aYFcLvl/gEu+GlCXwD+J8T2L1UkJdkNOXobTJ7RjswoiVMub+vzDNxrdUNRSbV8kA4QD++AZfPmfdyTD/N4bwZyFnSkInGQIns3MwuaiOiR+9iXe/bM5z+/cRB/Q6hWSesuwbMHCyh/MtBx1CTdKX1KwCzY2IJB7dI6RCzK1Dil3ehZrzxtcxm0Zpb7hzxC7EksihP4Zee+zNV9Mh/dWtqs2z918vUyvq/He1RwFpLc+rP/I215W7QveXHpAVMeEx9Po0avgwUvyxukNyiKEzCB5sZVh4XLAXdJuAwjZ/KlwY6nAHaywPzp1gwr1b6pSbFgXFTkdLuxgDXvMMm4MZ52peFuoi1ICrG9XaKLwoUT0vvgn32xDlh8IdhYC5ywzMEf2u4P1s7qFvWbl5dmm2Q/EvXgUKUSsHtR0qeNtxXjoRjICUDAIS4Np18weP94SFa5QlEgGqsvSXdEpqx4HnFsvn9y1HpU+Tp7fN2h+Gomys0a/yCtzM2cKq9EFOnDTU=
X-Amz-Target: DynamoDB_20120810.GetItem

{"ConsistentRead":true,"Key":{"LockID":{"S":"tui-tda-devops-terraform-state-480659675090/dlm-ami-backup/terraform.tfstate-md5"}},"ProjectionExpression":"LockID, Digest","TableName":"terraform-lock"}
-----------------------------------------------------
2022-08-09T17:48:09.487+0100 [DEBUG] [aws-sdk-go] DEBUG: Response dynamodb/GetItem Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 158
Content-Type: application/x-amz-json-1.0
Date: Tue, 09 Aug 2022 16:48:09 GMT
Server: Server
X-Amz-Crc32: 2775605383
X-Amzn-Requestid: 5BMT3KAA1J0VM335NMVJ106OMJVV4KQNSO5AEMVJF66Q9ASUAAJG

-----------------------------------------------------
2022-08-09T17:48:09.487+0100 [DEBUG] [aws-sdk-go] {"Item":{"Digest":{"S":"a46a8e5224e49073e5f2a9fe569a8e9f"},"LockID":{"S":"tui-tda-devops-terraform-state-480659675090/dlm-ami-backup/terraform.tfstate-md5"}}}
2022-08-09T17:48:09.490+0100 [DEBUG] created provider logger: level=debug
2022-08-09T17:48:09.490+0100 [INFO]  provider: configuring client automatic mTLS
2022-08-09T17:48:09.511+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.52.0/darwin_amd64/terraform-provider-aws_v3.52.0_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/aws/3.52.0/darwin_amd64/terraform-provider-aws_v3.52.0_x5]
2022-08-09T17:48:09.525+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.52.0/darwin_amd64/terraform-provider-aws_v3.52.0_x5 pid=78714
2022-08-09T17:48:09.525+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.52.0/darwin_amd64/terraform-provider-aws_v3.52.0_x5
2022-08-09T17:48:09.578+0100 [INFO]  provider.terraform-provider-aws_v3.52.0_x5: configuring server automatic mTLS: timestamp=2022-08-09T17:48:09.577+0100
2022-08-09T17:48:09.622+0100 [DEBUG] provider.terraform-provider-aws_v3.52.0_x5: plugin address: address=/var/folders/zf/2ypl182j5rj5mq18_7j_z_6w0000gn/T/plugin632157353 network=unix timestamp=2022-08-09T17:48:09.622+0100
2022-08-09T17:48:09.622+0100 [DEBUG] provider: using plugin: version=5
2022-08-09T17:48:09.781+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2022-08-09T17:48:09.785+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.52.0/darwin_amd64/terraform-provider-aws_v3.52.0_x5 pid=78714
2022-08-09T17:48:09.785+0100 [DEBUG] provider: plugin exited
2022-08-09T17:48:09.785+0100 [DEBUG] Building and walking validate graph
2022-08-09T17:48:09.786+0100 [DEBUG] ProviderTransformer: "aws_iam_role_policy_attachment.iam_policy_attach" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2022-08-09T17:48:09.786+0100 [DEBUG] ProviderTransformer: "aws_dlm_lifecycle_policy.development_servers" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2022-08-09T17:48:09.786+0100 [DEBUG] ProviderTransformer: "data.aws_iam_policy_document.assume_role_policy" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2022-08-09T17:48:09.786+0100 [DEBUG] ProviderTransformer: "aws_iam_role.this" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/aws"]
2022-08-09T17:48:09.786+0100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hashicorp/aws\"]" references: []
2022-08-09T17:48:09.786+0100 [DEBUG] ReferenceTransformer: "aws_iam_role.this" references: [var.prefix var.name data.aws_iam_policy_document.assume_role_policy]
2022-08-09T17:48:09.786+0100 [DEBUG] ReferenceTransformer: "aws_iam_role_policy_attachment.iam_policy_attach" references: [aws_iam_role.this]
2022-08-09T17:48:09.786+0100 [DEBUG] ReferenceTransformer: "aws_dlm_lifecycle_policy.development_servers" references: [aws_iam_role.this var.tags var.prefix var.name var.tags]
2022-08-09T17:48:09.786+0100 [DEBUG] ReferenceTransformer: "data.aws_iam_policy_document.assume_role_policy" references: []
2022-08-09T17:48:09.786+0100 [DEBUG] ReferenceTransformer: "var.prefix" references: []
2022-08-09T17:48:09.786+0100 [DEBUG] ReferenceTransformer: "var.name" references: []
2022-08-09T17:48:09.786+0100 [DEBUG] ReferenceTransformer: "var.tags" references: []
2022-08-09T17:48:09.787+0100 [DEBUG] Starting graph walk: walkValidate
2022-08-09T17:48:09.787+0100 [DEBUG] created provider logger: level=debug
2022-08-09T17:48:09.787+0100 [INFO]  provider: configuring client automatic mTLS
2022-08-09T17:48:09.807+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.52.0/darwin_amd64/terraform-provider-aws_v3.52.0_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/aws/3.52.0/darwin_amd64/terraform-provider-aws_v3.52.0_x5]
2022-08-09T17:48:09.822+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.52.0/darwin_amd64/terraform-provider-aws_v3.52.0_x5 pid=78715
2022-08-09T17:48:09.822+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.52.0/darwin_amd64/terraform-provider-aws_v3.52.0_x5
2022-08-09T17:48:09.872+0100 [INFO]  provider.terraform-provider-aws_v3.52.0_x5: configuring server automatic mTLS: timestamp=2022-08-09T17:48:09.872+0100
2022-08-09T17:48:09.917+0100 [DEBUG] provider: using plugin: version=5
2022-08-09T17:48:09.917+0100 [DEBUG] provider.terraform-provider-aws_v3.52.0_x5: plugin address: address=/var/folders/zf/2ypl182j5rj5mq18_7j_z_6w0000gn/T/plugin993022302 network=unix timestamp=2022-08-09T17:48:09.916+0100
2022-08-09T17:48:10.123+0100 [INFO]  provider.terraform-provider-aws_v3.52.0_x5: 2022/08/09 17:48:10 [WARN] Truncating attribute path of 0 diagnostics for TypeSet: timestamp=2022-08-09T17:48:10.123+0100
2022-08-09T17:48:10.123+0100 [INFO]  provider.terraform-provider-aws_v3.52.0_x5: 2022/08/09 17:48:10 [WARN] Truncating attribute path of 0 diagnostics for TypeSet: timestamp=2022-08-09T17:48:10.123+0100
2022-08-09T17:48:10.123+0100 [INFO]  provider.terraform-provider-aws_v3.52.0_x5: 2022/08/09 17:48:10 [WARN] Truncating attribute path of 0 diagnostics for TypeSet: timestamp=2022-08-09T17:48:10.123+0100
2022-08-09T17:48:10.125+0100 [ERROR] vertex "aws_dlm_lifecycle_policy.development_servers" error: Unsupported argument
2022-08-09T17:48:10.126+0100 [DEBUG] [aws-sdk-go] DEBUG: Request dynamodb/GetItem Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: dynamodb.eu-central-1.amazonaws.com
User-Agent: APN/1.0 HashiCorp/1.0 Terraform/1.2.2 aws-sdk-go/1.42.35 (go1.18.2; darwin; amd64)
Content-Length: 192
Accept-Encoding: identity
Authorization: AWS4-HMAC-SHA256 Credential=ASIAW72MMS7JG3TJM4PM/20220809/eu-central-1/dynamodb/aws4_request, SignedHeaders=accept-encoding;content-length;content-type;host;x-amz-date;x-amz-security-token;x-amz-target, Signature=692cec46e303eb1b96a6125f90b7e5ac6eb99ed7f3b1da21e875e448ebc9c3ba
Content-Type: application/x-amz-json-1.0
X-Amz-Date: 20220809T164810Z
X-Amz-Security-Token: IQoJb3JpZ2luX2VjEMn//////////wEaCWV1LXdlc3QtMSJIMEYCIQDQGEoHRiAF8s7Sg2Lpu4y3Fb2JHK2vr0FenaMQ8fvqCQIhALrUr/S8SF4g10t8QogS8mfDzrKSzs6Ex0NjoEu9NlI/KqgCCDIQBBoMNDgwNjU5Njc1MDkwIgz1yhgEhfTS79ttwOkqhQJboB/3rK+0JILvzz0kXlgwY8IYQ/LHTJDI86SQ38Hj0vWElpDhyGD783aYFcLvl/gEu+GlCXwD+J8T2L1UkJdkNOXobTJ7RjswoiVMub+vzDNxrdUNRSbV8kA4QD++AZfPmfdyTD/N4bwZyFnSkInGQIns3MwuaiOiR+9iXe/bM5z+/cRB/Q6hWSesuwbMHCyh/MtBx1CTdKX1KwCzY2IJB7dI6RCzK1Dil3ehZrzxtcxm0Zpb7hzxC7EksihP4Zee+zNV9Mh/dWtqs2z918vUyvq/He1RwFpLc+rP/I215W7QveXHpAVMeEx9Po0avgwUvyxukNyiKEzCB5sZVh4XLAXdJuAwjZ/KlwY6nAHaywPzp1gwr1b6pSbFgXFTkdLuxgDXvMMm4MZ52peFuoi1ICrG9XaKLwoUT0vvgn32xDlh8IdhYC5ywzMEf2u4P1s7qFvWbl5dmm2Q/EvXgUKUSsHtR0qeNtxXjoRjICUDAIS4Np18weP94SFa5QlEgGqsvSXdEpqx4HnFsvn9y1HpU+Tp7fN2h+Gomys0a/yCtzM2cKq9EFOnDTU=
X-Amz-Target: DynamoDB_20120810.GetItem

{"ConsistentRead":true,"Key":{"LockID":{"S":"tui-tda-devops-terraform-state-480659675090/dlm-ami-backup/terraform.tfstate"}},"ProjectionExpression":"LockID, Info","TableName":"terraform-lock"}
-----------------------------------------------------
2022-08-09T17:48:10.248+0100 [DEBUG] [aws-sdk-go] DEBUG: Response dynamodb/GetItem Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 419
Content-Type: application/x-amz-json-1.0
Date: Tue, 09 Aug 2022 16:48:10 GMT
Server: Server
X-Amz-Crc32: 2697672906
X-Amzn-Requestid: 86UD0DA4OJ6BM7HBRV3NUVVN0BVV4KQNSO5AEMVJF66Q9ASUAAJG

-----------------------------------------------------
2022-08-09T17:48:10.248+0100 [DEBUG] [aws-sdk-go] {"Item":{"LockID":{"S":"tui-tda-devops-terraform-state-480659675090/dlm-ami-backup/terraform.tfstate"},"Info":{"S":"{\"ID\":\"f22a6ac4-edb5-d651-23bc-dac14cda1bb1\",\"Operation\":\"OperationTypeApply\",\"Info\":\"\",\"Who\":\"marcomoscatiello@192.168.1.244\",\"Version\":\"1.2.2\",\"Created\":\"2022-08-09T16:48:09.159382Z\",\"Path\":\"tui-tda-devops-terraform-state-480659675090/dlm-ami-backup/terraform.tfstate\"}"}}}
2022-08-09T17:48:10.249+0100 [DEBUG] [aws-sdk-go] DEBUG: Request dynamodb/DeleteItem Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: dynamodb.eu-central-1.amazonaws.com
User-Agent: APN/1.0 HashiCorp/1.0 Terraform/1.2.2 aws-sdk-go/1.42.35 (go1.18.2; darwin; amd64)
Content-Length: 132
Accept-Encoding: identity
Authorization: AWS4-HMAC-SHA256 Credential=ASIAW72MMS7JG3TJM4PM/20220809/eu-central-1/dynamodb/aws4_request, SignedHeaders=accept-encoding;content-length;content-type;host;x-amz-date;x-amz-security-token;x-amz-target, Signature=52969dbc41fdd06095691a90f0bb5d1cca1d5a59a67ed1b61dcd4a0cd224b2d7
Content-Type: application/x-amz-json-1.0
X-Amz-Date: 20220809T164810Z
X-Amz-Security-Token: IQoJb3JpZ2luX2VjEMn//////////wEaCWV1LXdlc3QtMSJIMEYCIQDQGEoHRiAF8s7Sg2Lpu4y3Fb2JHK2vr0FenaMQ8fvqCQIhALrUr/S8SF4g10t8QogS8mfDzrKSzs6Ex0NjoEu9NlI/KqgCCDIQBBoMNDgwNjU5Njc1MDkwIgz1yhgEhfTS79ttwOkqhQJboB/3rK+0JILvzz0kXlgwY8IYQ/LHTJDI86SQ38Hj0vWElpDhyGD783aYFcLvl/gEu+GlCXwD+J8T2L1UkJdkNOXobTJ7RjswoiVMub+vzDNxrdUNRSbV8kA4QD++AZfPmfdyTD/N4bwZyFnSkInGQIns3MwuaiOiR+9iXe/bM5z+/cRB/Q6hWSesuwbMHCyh/MtBx1CTdKX1KwCzY2IJB7dI6RCzK1Dil3ehZrzxtcxm0Zpb7hzxC7EksihP4Zee+zNV9Mh/dWtqs2z918vUyvq/He1RwFpLc+rP/I215W7QveXHpAVMeEx9Po0avgwUvyxukNyiKEzCB5sZVh4XLAXdJuAwjZ/KlwY6nAHaywPzp1gwr1b6pSbFgXFTkdLuxgDXvMMm4MZ52peFuoi1ICrG9XaKLwoUT0vvgn32xDlh8IdhYC5ywzMEf2u4P1s7qFvWbl5dmm2Q/EvXgUKUSsHtR0qeNtxXjoRjICUDAIS4Np18weP94SFa5QlEgGqsvSXdEpqx4HnFsvn9y1HpU+Tp7fN2h+Gomys0a/yCtzM2cKq9EFOnDTU=
X-Amz-Target: DynamoDB_20120810.DeleteItem

{"Key":{"LockID":{"S":"tui-tda-devops-terraform-state-480659675090/dlm-ami-backup/terraform.tfstate"}},"TableName":"terraform-lock"}
-----------------------------------------------------
2022-08-09T17:48:10.359+0100 [DEBUG] [aws-sdk-go] DEBUG: Response dynamodb/DeleteItem Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 2
Content-Type: application/x-amz-json-1.0
Date: Tue, 09 Aug 2022 16:48:10 GMT
Server: Server
X-Amz-Crc32: 2745614147
X-Amzn-Requestid: T6QN02NLM3AGMUSHFQ4A3TCAU3VV4KQNSO5AEMVJF66Q9ASUAAJG

-----------------------------------------------------
2022-08-09T17:48:10.359+0100 [DEBUG] [aws-sdk-go] {}
╷
│ Error: Unsupported argument
│
│   on main.tf line 41, in resource "aws_dlm_lifecycle_policy" "development_servers":
│   41:     policy_type    = "IMAGE_MANAGEMENT"
│
│ An argument named "policy_type" is not expected here.
╵
2022-08-09T17:48:10.363+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2022-08-09T17:48:10.368+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.52.0/darwin_amd64/terraform-provider-aws_v3.52.0_x5 pid=78715
2022-08-09T17:48:10.368+0100 [DEBUG] provider: plugin exited
ERRO[0004] 1 error occurred:
    * exit status 1

Steps to Reproduce

  1. terraform apply (to create the resource)
  2. add the "policy_type = "IMAGE_MANAGEMENT" and terraform apply
  3. issue as in DEBUG

Important Factoids

References

--->

marcomoscatiello commented 2 years ago

basically i cannot create the dlm policy with policy_type "IMAGE_MANAGEMENT" , therefore i cannot get AMIs created by DLM, but only ebs snapshots.

justinretzolk commented 2 years ago

Hey @marcomoscatiello 👋 Based on your notes, it looks like you're running AWS Provider version v3.52.0. The policy_type argument was added in v4.9.0, so you'll need to update to at least that version of the provider in order to use the policy_type argument.

Please note there were a few significant changes in the latest major version (v4.0.0), so if you're updating an existing configuration, you'll need to account for that.

justinretzolk commented 9 months ago

Since we haven't heard back, I'm going to close this issue. If you're still having trouble, please feel free to open a new issue, referencing this one for context as needed.

github-actions[bot] commented 8 months 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.