-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Add name_prefix
to aws_iam_instance_profile
and aws_iam_role
#6939
Conversation
when you said that it doesn't quite work yet, what do you mean? :) P; |
Oh, the acceptance tests are failing and I don't understand why. |
ForceNew: true, | ||
Type: schema.TypeString, | ||
Optional: true, | ||
ForceNew: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshuaspence as you do not specify a name but do specify a name_prefix, you need to make name Computed. This means that when we set it in the Read, we will not get any alternative plan
Doing this locally gave me this:
make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSIAMInstanceProfile'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSIAMInstanceProfile -timeout 120m
=== RUN TestAccAWSIAMInstanceProfile_basic
--- PASS: TestAccAWSIAMInstanceProfile_basic (16.34s)
=== RUN TestAccAWSIAMInstanceProfile_namePrefix
--- PASS: TestAccAWSIAMInstanceProfile_namePrefix (17.01s)
PASS
ok github.com/hashicorp/terraform/builtin/providers/aws 33.367s
@joshuaspence ok, 2 small changes needed here and we are in a working situation :) P. |
name_prefix
to aws_iam_instance_profile
and aws_iam_role
name_prefix
to aws_iam_instance_profile
and aws_iam_role
Thanks, this should be ready to go now. I didn't quite understand why the |
name_prefix
to aws_iam_instance_profile
and aws_iam_role
name_prefix
to aws_iam_instance_profile
and aws_iam_role
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { | ||
// https://github.com/boto/botocore/blob/2485f5c/botocore/data/iam/2010-05-08/service-2.json#L8196-L8201 | ||
value := v.(string) | ||
if len(value) > 64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value probably isn't correct... are there any guarantees made about the length of the string returned by the uuidV4
function?
I'll give this a final set of tests when I am back online. Just a note on Computed - this is used when there is a chance that the value get's set on the Read but not in the initial config. The Computed means that Terraform will understand why there would be changes in that case P. |
@joshuaspence these looks great now :)
Thanks for the hard work! |
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. |
Ref #6099. Add a
name_prefix
attribute to theaws_iam_instance_profile
andaws_iam_role
resources.