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: Add custom_ca_bundle #23279

Merged
merged 7 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/23279.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
provider: Add `custom_ca_bundle` argument
```
5 changes: 5 additions & 0 deletions internal/conns/conns.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ type Config struct {
AccessKey string
AllowedAccountIds []string
AssumeRole *awsbase.AssumeRole
CustomCABundle string
DefaultTagsConfig *tftags.DefaultConfig
EC2MetadataServiceEndpoint string
EC2MetadataServiceEndpointMode string
Expand Down Expand Up @@ -1219,6 +1220,10 @@ func (c *Config) Client() (interface{}, error) {
awsbaseConfig.AssumeRole = c.AssumeRole
}

if c.CustomCABundle != "" {
//awsbaseConfig.CustomCABundle = c.CustomCABundle // needs new aws-sdk-go-base
}

if c.EC2MetadataServiceEndpoint != "" {
awsbaseConfig.EC2MetadataServiceEndpoint = c.EC2MetadataServiceEndpoint
awsbaseConfig.EC2MetadataServiceEndpointMode = c.EC2MetadataServiceEndpointMode
Expand Down
7 changes: 7 additions & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ func Provider() *schema.Provider {
Set: schema.HashString,
},
"assume_role": assumeRoleSchema(),
"custom_ca_bundle": {
Type: schema.TypeString,
Optional: true,
Description: "File containing custom root and intermediate certificates. " +
"Can also be configured using the `AWS_CA_BUNDLE` environment variable.",
YakDriver marked this conversation as resolved.
Show resolved Hide resolved
},
"default_tags": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -1915,6 +1921,7 @@ func providerConfigure(d *schema.ResourceData, terraformVersion string) (interfa
config := conns.Config{
AccessKey: d.Get("access_key").(string),
DefaultTagsConfig: expandProviderDefaultTags(d.Get("default_tags").([]interface{})),
CustomCABundle: d.Get("custom_ca_bundle").(string),
EC2MetadataServiceEndpoint: d.Get("ec2_metadata_service_endpoint").(string),
EC2MetadataServiceEndpointMode: d.Get("ec2_metadata_service_endpoint_mode").(string),
Endpoints: make(map[string]string),
Expand Down
1 change: 1 addition & 0 deletions website/docs/guides/version-4-upgrade.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ provider "aws" {
Version 4.x adds these new `provider` arguments:

* `assume_role.duration` - Assume role duration as a string, _e.g._, `"1h"` or `"1h30s"`. Terraform AWS Provider v4.0.0 deprecates `assume_role.duration_seconds` and a future version will remove it.
* `custom_ca_bundle` - File containing custom root and intermediate certificates. Can also be configured using the `AWS_CA_BUNDLE` environment variable.
* `ec2_metadata_service_endpoint` - Address of the EC2 metadata service (IMDS) endpoint to use. Can also be set with the `AWS_EC2_METADATA_SERVICE_ENDPOINT` environment variable.
* `ec2_metadata_service_endpoint_mode` - Mode to use in communicating with the metadata service. Valid values are `IPv4` and `IPv6`. Can also be set with the `AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE` environment variable.
* `s3_use_path_style` - Replaces `s3_force_path_style`, which has been deprecated in Terraform AWS Provider v4.0.0 and support will be removed in a future version.
Expand Down
1 change: 1 addition & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ In addition to [generic `provider` arguments](https://www.terraform.io/docs/conf
* `access_key` - (Optional) AWS access key. Can also be set with the `AWS_ACCESS_KEY_ID` environment variable, or via a shared credentials file if `profile` is specified. See also `secret_key`.
* `allowed_account_ids` - (Optional) List of allowed AWS account IDs to prevent you from mistakenly using an incorrect one (and potentially end up destroying a live environment). Conflicts with `forbidden_account_ids`.
* `assume_role` - (Optional) Configuration block for an assumed role. See below. Only one `assume_role` block may be in the configuration.
* `custom_ca_bundle` - (Optional) File containing custom root and intermediate certificates. Can also be set using the `AWS_CA_BUNDLE` environment variable.
* `default_tags` - (Optional) Configuration block with resource tag settings to apply across all resources handled by this provider (see the [Terraform multiple provider instances documentation](/docs/configuration/providers.html#alias-multiple-provider-instances) for more information about additional provider configurations). This is designed to replace redundant per-resource `tags` configurations. Provider tags can be overridden with new values, but not excluded from specific resources. To override provider tag values, use the `tags` argument within a resource to configure new tag values for matching keys. See the [`default_tags`](#default_tags-configuration-block) Configuration Block section below for example usage and available arguments. This functionality is supported in all resources that implement `tags`, with the exception of the `aws_autoscaling_group` resource.
* `ec2_metadata_service_endpoint` - (Optional) Address of the EC2 metadata service (IMDS) endpoint to use. Can also be set with the `AWS_EC2_METADATA_SERVICE_ENDPOINT` environment variable.
* `ec2_metadata_service_endpoint_mode` - (Optional) Mode to use in communicating with the metadata service. Valid values are `IPv4` and `IPv6`. Can also be set with the `AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE` environment variable.
Expand Down