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

F/resource aws codestarconnections connection - support for host_arn #19284

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
568483c
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
5273c73
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
f2c5be9
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
1e48317
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
29747b7
Merge remote-tracking branch 'origin/master'
nikhil-goenka Apr 30, 2021
98e41ce
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
598e773
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
15ec17c
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
bc225f5
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
e1724ca
Merge remote-tracking branch 'origin/master'
nikhil-goenka May 1, 2021
4a0d439
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
6de2c69
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
4b02fb8
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
2cec2e1
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
00dfa0f
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
8d235f4
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
91e1233
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
bdc8152
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
1f438fa
Merge remote-tracking branch 'origin/master'
nikhil-goenka May 2, 2021
05b240f
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
03029df
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
d0e44c2
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
38111b2
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
8a438a5
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
514ec73
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
3a1bb6e
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
37a7e37
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
f50d10e
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
2d998a6
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
f3142cb
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
8c765d8
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
bb2cc6c
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
7075f84
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
94bf75b
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
00f5a58
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
388ac4a
Merge remote-tracking branch 'origin/master'
nikhil-goenka May 6, 2021
0a8da6f
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
858b114
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
9b70ead
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
69927ed
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
dc3849a
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
e8f8c68
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
b44b58c
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
aa19a48
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
2893c5e
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
2235023
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
953efd2
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
25e0648
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
886b03f
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
6e70b6a
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
fb3dc60
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
0246698
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
c107310
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
796178d
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
d7a5622
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
1466508
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
c23ed80
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
988dff4
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
d905781
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
db165cf
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
8d9a38d
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
a420ee9
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
95b75f9
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
666c3cd
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
456d57e
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
108daba
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
c2ba083
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 22, 2021
295e69d
f/aws_securityhub_member: email is optional variable
nikhil-goenka Apr 25, 2021
903ff3a
Merge remote-tracking branch 'origin/master'
nikhil-goenka May 8, 2021
c150f05
support for GitHubEnterpriseServer host_arn on codestarconnections_co…
nikhil-goenka May 8, 2021
cfd6e41
support for GitHubEnterpriseServer host_arn on codestarconnections_co…
nikhil-goenka May 8, 2021
ab16139
Add CHANGELOG entry.
ewbankkit May 10, 2021
b19fc84
d/aws_codestarconnections_connection: Add 'host_arn' attribute.
ewbankkit May 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changelog/19284.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:enhancement
resource/aws_codestarconnections_connection: Add `host_arn` argument
```

```release-note:enhancement
data-source/aws_codestarconnections_connection: Add `host_arn` attribute
```
6 changes: 6 additions & 0 deletions aws/data_source_aws_codestarconnections_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ func dataSourceAwsCodeStarConnectionsConnection() *schema.Resource {
Computed: true,
},

"host_arn": {
Type: schema.TypeString,
Computed: true,
},

"name": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -54,6 +59,7 @@ func dataSourceAwsCodeStarConnectionsConnectionRead(d *schema.ResourceData, meta

d.SetId(arn)
d.Set("connection_status", connection.ConnectionStatus)
d.Set("host_arn", connection.HostArn)
d.Set("name", connection.ConnectionName)
d.Set("provider_type", connection.ProviderType)

Expand Down
28 changes: 23 additions & 5 deletions aws/resource_aws_codestarconnections_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,21 @@ func resourceAwsCodeStarConnectionsConnection() *schema.Resource {
ForceNew: true,
},

"host_arn": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ConflictsWith: []string{"provider_type"},
ValidateFunc: validateArn,
},

"provider_type": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice(codestarconnections.ProviderType_Values(), false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
ConflictsWith: []string{"host_arn"},
ValidateFunc: validation.StringInSlice(codestarconnections.ProviderType_Values(), false),
},

"tags": tagsSchema(),
Expand All @@ -62,7 +72,14 @@ func resourceAwsCodeStarConnectionsConnectionCreate(d *schema.ResourceData, meta

params := &codestarconnections.CreateConnectionInput{
ConnectionName: aws.String(d.Get("name").(string)),
ProviderType: aws.String(d.Get("provider_type").(string)),
}

if v, ok := d.GetOk("provider_type"); ok {
params.ProviderType = aws.String(v.(string))
}

if v, ok := d.GetOk("host_arn"); ok {
params.HostArn = aws.String(v.(string))
}

if len(tags) > 0 {
Expand Down Expand Up @@ -103,6 +120,7 @@ func resourceAwsCodeStarConnectionsConnectionRead(d *schema.ResourceData, meta i
d.Set("arn", connection.ConnectionArn)
d.Set("connection_status", connection.ConnectionStatus)
d.Set("name", connection.ConnectionName)
d.Set("host_arn", connection.HostArn)
d.Set("provider_type", connection.ProviderType)

tags, err := keyvaluetags.CodestarconnectionsListTags(conn, arn)
Expand Down
47 changes: 47 additions & 0 deletions aws/resource_aws_codestarconnections_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,38 @@ func TestAccAWSCodeStarConnectionsConnection_Basic(t *testing.T) {
})
}

func TestAccAWSCodeStarConnectionsConnection_HostArn(t *testing.T) {
var v codestarconnections.Connection
resourceName := "aws_codestarconnections_connection.test"
rName := acctest.RandomWithPrefix("tf-acc-test")

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) },
ErrorCheck: testAccErrorCheck(t, codestarconnections.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSCodeStarConnectionsConnectionDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSCodeStarConnectionsConnectionConfigHostArn(rName),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckAWSCodeStarConnectionsConnectionExists(resourceName, &v),
testAccMatchResourceAttrRegionalARN(resourceName, "id", "codestar-connections", regexp.MustCompile("connection/.+")),
testAccMatchResourceAttrRegionalARN(resourceName, "arn", "codestar-connections", regexp.MustCompile("connection/.+")),
testAccMatchResourceAttrRegionalARN(resourceName, "host_arn", "codestar-connections", regexp.MustCompile("host/.+")),
resource.TestCheckResourceAttr(resourceName, "provider_type", codestarconnections.ProviderTypeGitHubEnterpriseServer),
resource.TestCheckResourceAttr(resourceName, "name", rName),
resource.TestCheckResourceAttr(resourceName, "connection_status", codestarconnections.ConnectionStatusPending),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAWSCodeStarConnectionsConnection_disappears(t *testing.T) {
var v codestarconnections.Connection
resourceName := "aws_codestarconnections_connection.test"
Expand Down Expand Up @@ -166,6 +198,21 @@ resource "aws_codestarconnections_connection" "test" {
`, rName)
}

func testAccAWSCodeStarConnectionsConnectionConfigHostArn(rName string) string {
return fmt.Sprintf(`
resource "aws_codestarconnections_host" "test" {
name = %[1]q
provider_endpoint = "https://test.com"
provider_type = "GitHubEnterpriseServer"
}

resource "aws_codestarconnections_connection" "test" {
name = %[1]q
host_arn = aws_codestarconnections_host.test.arn
}
`, rName)
}

func testAccAWSCodeStarConnectionsConnectionConfigTags1(rName string, tagKey1 string, tagValue1 string) string {
return fmt.Sprintf(`
resource "aws_codestarconnections_connection" "test" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ In addition to all arguments above, the following attributes are exported:

* `connection_status` - The CodeStar Connection status. Possible values are `PENDING`, `AVAILABLE` and `ERROR`.
* `id` - The CodeStar Connection ARN.
* `host_arn` - The Amazon Resource Name (ARN) of the host associated with the connection.
* `name` - The name of the CodeStar Connection. The name is unique in the calling AWS account.
* `provider_type` - The name of the external provider where your third-party code repository is configured. Possible values are `Bitbucket`, `GitHub`, or `GitHubEnterpriseServer`.
* `tags` - Map of key-value resource tags to associate with the resource.
3 changes: 2 additions & 1 deletion website/docs/r/codestarconnections_connection.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ resource "aws_codepipeline" "example" {
The following arguments are supported:

* `name` - (Required) The name of the connection to be created. The name must be unique in the calling AWS account. Changing `name` will create a new resource.
* `provider_type` - (Required) The name of the external provider where your third-party code repository is configured. Valid values are `Bitbucket`, `GitHub`, or `GitHubEnterpriseServer`. Changing `provider_type` will create a new resource.
* `provider_type` - (Optional) The name of the external provider where your third-party code repository is configured. Valid values are `Bitbucket`, `GitHub` or `GitHubEnterpriseServer`. Changing `provider_type` will create a new resource. Conflicts with `host_arn`
* `host_arn` - (Optional) The Amazon Resource Name (ARN) of the host associated with the connection. Conflicts with `provider_type`
* `tags` - (Optional) Map of key-value resource tags to associate with the resource. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level.

## Attributes Reference
Expand Down