-
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
provider/aws: Added Lambda Environment configuration (supersedes #10255) #10275
Conversation
log.Printf("[INFO] Setting Lambda %s VPC config %#v from API", d.Id(), config) | ||
vpcSetErr := d.Set("vpc_config", config) | ||
if vpcSetErr != nil { | ||
return fmt.Errorf("Failed setting vpc_config: %s", vpcSetErr) |
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.
Could you share the config you used to find that please? thanks!
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.
it was really weird, I never specified the vpc config, but if I had env vars specified, then removed one in the AWS web UI, my next plan
showed a diff because VPC config was coming back "empty"
Ex config: https://gist.github.com/catsby/f3dcc08f936db041ea52263bccba83b9
It's fixed here though so I doubt you'll see it
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.
Oh got it! good catch :)
(I would have use my own PR to reproduce, but still, thanks!)
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.
Example DEBUG output of said empty vpc:
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: Function:
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: {
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: CodeSha256: "Ux/n9CP8l+7Ht0tICw0QPs0yLdC1b+1nJ9K5MZR9ENw=",
[ ... ]
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: Role: "arn:aws:iam::187416307283:role/cts-iam-lambda",
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: Runtime: "nodejs",
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: Timeout: 3,
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: Version: "$LATEST",
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: VpcConfig: {
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: SecurityGroupIds: [],
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: SubnetIds: [],
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: VpcId: ""
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: }
2016/11/21 17:03:41 [DEBUG] plugin: terraform-provider-aws: }
Only happens if I edit the ENV vars in the Web ui (in this case I added one)
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.
(I would have use my own PR to reproduce, but still, thanks!)
You still can! The only way I could reproduce is if I had 2+ env vars specified in config, and then used the web UI to remove one of them. Then my next plan would show the ForceNew diff as well as the config diff
envSetErr = d.Set("environment", []interface{}{}) | ||
} else { | ||
envSetErr = d.Set("environment", flattenLambdaEnvironment(function.Environment.Variables)) | ||
} |
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.
I think I forgot this part... Newbie mistake... 👍
Thanks for the help and review on this, learned a lot as a newcomer :) |
Tests after a small refactor:
merging, thanks @Ninir ! |
@kwilczynski I'm not aware of them, and this PR has already been merged :/ can you open a new issue? Or new PR? |
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. |
Continues #10255 with some touchups, namely
environment
wasn't being read. I also encountered an issue where the API would return an "empty" vpc config, so now we filter those out instead of populating the state with an empty config, triggering aForceNew
.@Ninir please take a look!