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

r/aws_datasync_agent: remove ExactlyOneOf activation_key, ip_address #35150

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .changelog/35150.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_datasync_agent: Fix import of agents created with `activation_key` by removing requirement for one of `ip_address` or `activation_key` to be set
```
17 changes: 10 additions & 7 deletions internal/service/datasync/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,14 @@ func ResourceAgent() *schema.Resource {
Optional: true,
Computed: true,
ForceNew: true,
ExactlyOneOf: []string{"activation_key", "ip_address"},
ConflictsWith: []string{"private_link_endpoint"},
ConflictsWith: []string{"private_link_endpoint", "ip_address"},
},
"ip_address": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ExactlyOneOf: []string{"activation_key", "ip_address"},
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ConflictsWith: []string{"activation_key"},
},
"private_link_endpoint": {
Type: schema.TypeString,
Expand Down Expand Up @@ -107,6 +106,10 @@ func resourceAgentCreate(ctx context.Context, d *schema.ResourceData, meta inter

// Perform one time fetch of activation key from gateway IP address.
if activationKey == "" {
if agentIpAddress == "" {
return sdkdiag.AppendErrorf(diags, "one of activation_key or ip_address is required")
}

client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
Expand Down
Loading