1 Answer
- Newest
- Most votes
- Most comments
1
Hello.
How about creating an IAM user after the IAM group is created using "DependsOn" like below?
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html
Group:
Type: "AWS::IAM::Group"
Properties:
GroupName: "custom"
Path: "/"
ManagedPolicyArns:
- "arn:aws:iam::aws:policy/S3FullAccess"
UserHogehoge:
DependsOn: Group
Type: "AWS::IAM::User"
Properties:
Path: "/"
UserName: "hogehoge"
Groups:
- !Ref Group
Relevant content
- asked 9 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
Hello, I had that idea too but it seems as the DependsOn key is not permitted when creating a user, i got the following error the first time i tried it:
Properties validation failed for resource USRENAME with message: #: extraneous key [DependsOn] is not permitted.
So for your example it would be:
Properties validation failed for resource hogehoge with message: #: extraneous key [DependsOn] is not permitted.
No, you can use "DependsOn". We are seeing successful deployments using the template below. The error you shared can occur if the yaml is mis-indented.
I'm using json format:
Does the position of the DependsOn key matter? I just saw that this template is using the FormatVersion 2010-09-09 also maybe that might be an issue?
The position of "DependsOn" is important. Please try as below.
Good morning, I just tried it and i still get the same error that [DependsOn] is not permitted. :(
Update: I tried to create a new stack and it worked on there no error for DependsOn so I assume it might be some other issue with the one stack already in place?