From dea5f4ea84dc7e4f2afadd7aef1f2e2c17800bd0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 11 Apr 2024 14:37:38 -0400 Subject: [PATCH 1/4] iam/docs: Update documentation --- .../docs/r/iam_policy_attachment.html.markdown | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/website/docs/r/iam_policy_attachment.html.markdown b/website/docs/r/iam_policy_attachment.html.markdown index 13438de93c5..73f8e268b45 100644 --- a/website/docs/r/iam_policy_attachment.html.markdown +++ b/website/docs/r/iam_policy_attachment.html.markdown @@ -16,6 +16,8 @@ Attaches a Managed IAM Policy to user(s), role(s), and/or group(s) ~> **NOTE:** For a given role, this resource is incompatible with using the [`aws_iam_role` resource](/docs/providers/aws/r/iam_role.html) `managed_policy_arns` argument. When using that argument and this resource, both will attempt to manage the role's managed policy attachments and Terraform will show a permanent difference. +~> **NOTE:** To ensure Terraform correctly manages dependencies during updates, use a reference to the IAM resource when defining the `policy_arn` for `aws_iam_policy_attachment`, rather than constructing the ARN directly. For example, use `policy_arn = aws_iam_policy.example.arn` instead of `policy_arn = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:policy/Example"`. Failing to do so may lead to errors like `DeleteConflict: Cannot delete a policy attached to entities` or `NoSuchEntity`. + ## Example Usage ```terraform @@ -72,15 +74,15 @@ resource "aws_iam_policy_attachment" "test-attach" { This resource supports the following arguments: -* `name` (Required) - The name of the attachment. This cannot be an empty string. -* `users` (Optional) - The user(s) the policy should be applied to -* `roles` (Optional) - The role(s) the policy should be applied to -* `groups` (Optional) - The group(s) the policy should be applied to -* `policy_arn` (Required) - The ARN of the policy you want to apply +* `name` (Required) - Name of the attachment. This cannot be an empty string. +* `users` (Optional) - User(s) the policy should be applied to +* `roles` (Optional) - Role(s) the policy should be applied to +* `groups` (Optional) - Group(s) the policy should be applied to +* `policy_arn` (Required) - ARN of the policy you want to apply ## Attribute Reference This resource exports the following attributes in addition to the arguments above: -* `id` - The policy's ID. -* `name` - The name of the attachment. +* `id` - Policy's ID. +* `name` - Name of the attachment. From 539ea23a406c2d8c4b486dcd27d0c0b12da2a6ef Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 11 Apr 2024 14:38:06 -0400 Subject: [PATCH 2/4] go mod tidy --- tools/tfsdk2fw/go.mod | 16 ++++++++-------- tools/tfsdk2fw/go.sum | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/tools/tfsdk2fw/go.mod b/tools/tfsdk2fw/go.mod index cbf9877f8d9..dd412ddc254 100644 --- a/tools/tfsdk2fw/go.mod +++ b/tools/tfsdk2fw/go.mod @@ -200,15 +200,15 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 // indirect - github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.51 // indirect - github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.52 // indirect + github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52 // indirect + github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53 // indirect github.com/hashicorp/awspolicyequivalence v1.6.0 // indirect github.com/hashicorp/cli v1.1.6 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637 // indirect - github.com/hashicorp/go-hclog v1.6.2 // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-plugin v1.6.0 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect @@ -254,13 +254,13 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/zclconf/go-cty v1.14.3 // indirect - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.49.0 // indirect - go.opentelemetry.io/otel v1.24.0 // indirect - go.opentelemetry.io/otel/metric v1.24.0 // indirect - go.opentelemetry.io/otel/trace v1.24.0 // indirect + go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0 // indirect + go.opentelemetry.io/otel v1.25.0 // indirect + go.opentelemetry.io/otel/metric v1.25.0 // indirect + go.opentelemetry.io/otel/trace v1.25.0 // indirect golang.org/x/crypto v0.22.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.23.0 // indirect + golang.org/x/net v0.24.0 // indirect golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.18.0 // indirect diff --git a/tools/tfsdk2fw/go.sum b/tools/tfsdk2fw/go.sum index 314e04081ff..b4b9f8f2032 100644 --- a/tools/tfsdk2fw/go.sum +++ b/tools/tfsdk2fw/go.sum @@ -419,10 +419,10 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 h1:N2V/ooY+BPQwwN3qPRIztByR8mWN6IqgULqVzGoUlog= github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0/go.mod h1:HAmscHyzSOfB1Dr16KLc177KNbn83wscnZC+N7WyaM8= -github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.51 h1:aoiGiU+WKzvavgnSai5xakBEsN3FcmbBnjWw0GJpgJY= -github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.51/go.mod h1:0oQVA0VrNZ0HGRY+hiLsmFJPxtR7n9qrBlUbv8ZYY/A= -github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.52 h1:pdcCSH8oXn6Fo1kJ0HY9VVxn+NTPTusKioD86ccP6bA= -github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.52/go.mod h1:26UtWMtIWNL4AUDfdigiPt2y1t6WgfDeShmEWWsym+Q= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52 h1:bKvTdvF3jNgDt4rHDk55BxYnyofFVJhXHMj+RBRUmc0= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52/go.mod h1:YlwqmXqrK6MNTtW1cCjPFkoc3plCT939B+Yjmq+/DBc= +github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53 h1:hrcewXLBw48wZc6fe7blETM94eTwzTouQ4zWqQvjVwU= +github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53/go.mod h1:458CK33gIkH+FvTU2aZcJy2IANdsE3USy1NAUhK/uFg= github.com/hashicorp/awspolicyequivalence v1.6.0 h1:7aadmkalbc5ewStC6g3rljx1iNvP4QyAhg2KsHx8bU8= github.com/hashicorp/awspolicyequivalence v1.6.0/go.mod h1:9IOaIHx+a7C0NfUNk1A93M7kHd5rJ19aoUx37LZGC14= github.com/hashicorp/cli v1.1.6 h1:CMOV+/LJfL1tXCOKrgAX0uRKnzjj/mpmqNXloRSy2K8= @@ -437,8 +437,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637 h1:Ud/6/AdmJ1R7ibdS0Wo5MWPj0T1R0fkpaD087bBaW8I= github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= -github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= -github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= @@ -584,14 +584,14 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.49.0 h1:2P+w3GiH9Esh8f5mEa8lTB+8Ruh7XCsCuQah0tLEmE4= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.49.0/go.mod h1:P9cJwfcWVLOHu/8swW4Jfl8AX/a4eXTptW9rp0Uv/co= -go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= -go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= -go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= -go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= -go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0 h1:0zXBsTKPsly2MlyLYyra1GuL23fsY5RMsi6E2ZOe988= +go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0/go.mod h1:Tztzncf+ezyOCjXz8zRjVL2agqyBxhymGnK6rqgoY5c= +go.opentelemetry.io/otel v1.25.0 h1:gldB5FfhRl7OJQbUHt/8s0a7cE8fbsPAtdpRaApKy4k= +go.opentelemetry.io/otel v1.25.0/go.mod h1:Wa2ds5NOXEMkCmUou1WA7ZBfLTHWIsp034OVD7AO+Vg= +go.opentelemetry.io/otel/metric v1.25.0 h1:LUKbS7ArpFL/I2jJHdJcqMGxkRdxpPHE0VU/D4NuEwA= +go.opentelemetry.io/otel/metric v1.25.0/go.mod h1:rkDLUSd2lC5lq2dFNrX9LGAbINP5B7WBkC78RXCpH5s= +go.opentelemetry.io/otel/trace v1.25.0 h1:tqukZGLwQYRIFtSQM2u2+yfMVTgGVeqRLPUYx1Dq6RM= +go.opentelemetry.io/otel/trace v1.25.0/go.mod h1:hCCs70XM/ljO+BeQkyFnbK28SBIJ/Emuha+ccrCRT7I= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= @@ -607,8 +607,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From d76d86dfb4013aa97df0748049e2a64745fd509d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 11 Apr 2024 14:41:50 -0400 Subject: [PATCH 3/4] iam/policy_attachment: Update docs --- website/docs/r/iam_policy_attachment.html.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/r/iam_policy_attachment.html.markdown b/website/docs/r/iam_policy_attachment.html.markdown index 73f8e268b45..276bcf43203 100644 --- a/website/docs/r/iam_policy_attachment.html.markdown +++ b/website/docs/r/iam_policy_attachment.html.markdown @@ -75,10 +75,10 @@ resource "aws_iam_policy_attachment" "test-attach" { This resource supports the following arguments: * `name` (Required) - Name of the attachment. This cannot be an empty string. -* `users` (Optional) - User(s) the policy should be applied to -* `roles` (Optional) - Role(s) the policy should be applied to -* `groups` (Optional) - Group(s) the policy should be applied to -* `policy_arn` (Required) - ARN of the policy you want to apply +* `users` (Optional) - User(s) the policy should be applied to. +* `roles` (Optional) - Role(s) the policy should be applied to. +* `groups` (Optional) - Group(s) the policy should be applied to. +* `policy_arn` (Required) - ARN of the policy you want to apply. Typically this should be a reference to the ARN of another reference to ensure dependency ordering, such as `aws_iam_policy.example.arn`. ## Attribute Reference From e8040f2e42693710654f7938a3daf50085f202c6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 11 Apr 2024 14:42:36 -0400 Subject: [PATCH 4/4] iam/policy_attachment: Update docs --- website/docs/r/iam_policy_attachment.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/iam_policy_attachment.html.markdown b/website/docs/r/iam_policy_attachment.html.markdown index 276bcf43203..c2cd5dcb724 100644 --- a/website/docs/r/iam_policy_attachment.html.markdown +++ b/website/docs/r/iam_policy_attachment.html.markdown @@ -78,7 +78,7 @@ This resource supports the following arguments: * `users` (Optional) - User(s) the policy should be applied to. * `roles` (Optional) - Role(s) the policy should be applied to. * `groups` (Optional) - Group(s) the policy should be applied to. -* `policy_arn` (Required) - ARN of the policy you want to apply. Typically this should be a reference to the ARN of another reference to ensure dependency ordering, such as `aws_iam_policy.example.arn`. +* `policy_arn` (Required) - ARN of the policy you want to apply. Typically this should be a reference to the ARN of another resource to ensure dependency ordering, such as `aws_iam_policy.example.arn`. ## Attribute Reference