Skip to content
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 aws_api_gateway_api_key value attribute #9462

Merged
merged 1 commit into from
Mar 20, 2017

Conversation

Ninir
Copy link
Contributor

@Ninir Ninir commented Oct 19, 2016

Hi there!

This closes #11105

Relevant Terraform version

Checked against: Terraform v0.7.8-dev (bdb6089+CHANGES)

Acceptance Tests

$ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSAPIGatewayApiKey_basic'                                                
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/01/09 11:04:08 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAPIGatewayApiKey_basic -timeout 120m
=== RUN   TestAccAWSAPIGatewayApiKey_basic
--- PASS: TestAccAWSAPIGatewayApiKey_basic (20.87s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	20.898s

References

API Reference from the SDK

@Ninir Ninir changed the title [AWS / API Gateway] Added aws_api_gateway_api_key value attribute provider/aws: Added aws_api_gateway_api_key value attribute Oct 19, 2016
Copy link
Contributor

@stack72 stack72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Ninir

Thanks for the work here - I am slightly worried that we are sending a value as part of the API request without it being able to be set by the user - thoughts on this?

Also, can this value be updated? Or will a new value cause a new resource?

Paul

@@ -71,6 +76,7 @@ func resourceAwsApiGatewayApiKeyCreate(d *schema.ResourceData, meta interface{})
Description: aws.String(d.Get("description").(string)),
Enabled: aws.Bool(d.Get("enabled").(bool)),
StageKeys: expandApiGatewayStageKeys(d),
Value: aws.String(d.Get("value").(string)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IF this value is Computed: true and then nothing else, a user cannot set it

therefore this will fail - does the value need to be optional as well?

@@ -86,7 +92,8 @@ func resourceAwsApiGatewayApiKeyRead(d *schema.ResourceData, meta interface{}) e
log.Printf("[DEBUG] Reading API Gateway API Key: %s", d.Id())

apiKey, err := conn.GetApiKey(&apigateway.GetApiKeyInput{
ApiKey: aws.String(d.Id()),
ApiKey: aws.String(d.Id()),
IncludeValue: aws.Bool(true),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be IncludeValue true only if a value is set - thoughts?

Copy link
Contributor Author

@Ninir Ninir Oct 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the value is always set, either by AWS itself (generated), or the user (custom).
I guess it is just good to always expose it :)

@Ninir Ninir force-pushed the api_key_value branch 2 times, most recently from 978bee5 to 486b02a Compare October 23, 2016 12:52
@Ninir Ninir changed the title provider/aws: Added aws_api_gateway_api_key value attribute [WIP] provider/aws: Added aws_api_gateway_api_key value attribute Oct 25, 2016
@Ninir Ninir force-pushed the api_key_value branch 5 times, most recently from 024bd60 to 52b4c5c Compare October 25, 2016 10:53
@Ninir Ninir changed the title [WIP] provider/aws: Added aws_api_gateway_api_key value attribute provider/aws: Added aws_api_gateway_api_key value attribute Oct 25, 2016
@stack72
Copy link
Contributor

stack72 commented Jan 9, 2017

Hi @Ninir

If you can, please rebase this and I can get this tested and merged finally :)

Thanks

Paul

@Ninir
Copy link
Contributor Author

Ninir commented Jan 9, 2017

@stack72 Here it is! Currently running the acceptance test (just in case).

EDIT:

$ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSAPIGatewayApiKey_basic'  
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/01/09 14:27:30 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAPIGatewayApiKey_basic -timeout 120m
=== RUN   TestAccAWSAPIGatewayApiKey_basic
--- PASS: TestAccAWSAPIGatewayApiKey_basic (22.78s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	22.804s

@stack72
Copy link
Contributor

stack72 commented Jan 9, 2017

Hi @Ninir

Is this a sensitive value? i.e. is this something we want added to state?

Paul

@Ninir
Copy link
Contributor Author

Ninir commented Jan 9, 2017

@stack72

We may want to set is as sensitive or hide it from the state, since it acts as an authentication token yes.

Will set the attribute in the schema. Thanks for pointing this out!

@Ninir Ninir force-pushed the api_key_value branch 2 times, most recently from abf7ac9 to 8ec2694 Compare January 10, 2017 08:37
@Ninir
Copy link
Contributor Author

Ninir commented Jan 17, 2017

Hi @stack72,

The sensitive attribute has been set.
is there something else you would want me to do?

Thanks!
Gauthier

@stack72
Copy link
Contributor

stack72 commented Mar 16, 2017

Hi @Ninir

If you can rebase this, then we can get this merged - sorry this has taken so long!

Paul

@Ninir
Copy link
Contributor Author

Ninir commented Mar 16, 2017

Hi Paul,

Just rebased it :)

As a note, the "API Gateway" API changed so even if this work will still help previous version of the API Gateways, new API Gateways will require Usage Plans (work already started on my own, PR exposed and soon to be ended) and the related API Keys.

Thanks!

@stack72
Copy link
Contributor

stack72 commented Mar 20, 2017

LGTM now thanks :)

@stack72 stack72 merged commit 23ebd0b into hashicorp:master Mar 20, 2017
@Ninir Ninir deleted the api_key_value branch March 22, 2017 08:57
@ghost
Copy link

ghost commented Apr 15, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

provider/aws: Add the ability to set the API Gateway Key value
3 participants