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: Add agent_version argument to AWS_OPSWORKS_STACK #6493

Merged
merged 1 commit into from
May 5, 2016
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
9 changes: 9 additions & 0 deletions builtin/providers/aws/resource_aws_opsworks_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ func resourceAwsOpsworksStack() *schema.Resource {
Delete: resourceAwsOpsworksStackDelete,

Schema: map[string]*schema.Schema{
"agent_version": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},

"id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -265,6 +270,7 @@ func resourceAwsOpsworksStackRead(d *schema.ResourceData, meta interface{}) erro
}

stack := resp.Stacks[0]
d.Set("agent_version", stack.AgentVersion)
d.Set("name", stack.Name)
d.Set("region", stack.Region)
d.Set("default_instance_profile_arn", stack.DefaultInstanceProfileArn)
Expand Down Expand Up @@ -397,6 +403,9 @@ func resourceAwsOpsworksStackUpdate(d *schema.ResourceData, meta interface{}) er
Attributes: make(map[string]*string),
CustomCookbooksSource: resourceAwsOpsworksStackCustomCookbooksSource(d),
}
if v, ok := d.GetOk("agent_version"); ok {
req.AgentVersion = aws.String(v.(string))
}
if v, ok := d.GetOk("default_os"); ok {
req.DefaultOs = aws.String(v.(string))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The following arguments are supported:
* `service_role_arn` - (Required) The ARN of an IAM role that the OpsWorks service will act as.
* `default_instance_profile_arn` - (Required) The ARN of an IAM Instance Profile that created instances
will have by default.
* `agent_version` - (Optional) If set to `"LATEST"`, OpsWorks will automatically install the latest version.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is Latest the only accepted option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Paul!

The SDK also allows you to pass specific version numbers there too, but that feature is already exposed at the instance level. The stack being the parent of the instance, will set the instance version by default. The reason for the PR is that automatic updates are not allowed at the instance level (and it's not a default).

You can find supported versions for your stack from the cli:

$ aws opsworks describe-agent-versions --stack-id ***************************************

{
    "AgentVersions": [
        {
            "Version": "3421-20150611173115",
            "ConfigurationManager": {
                "Version": "11.10",
                "Name": "Chef"
            }
        },
        {
            "Version": "3422-20150629124612",
            "ConfigurationManager": {
                "Version": "11.10",
                "Name": "Chef"
            }
        },
        {
            "Version": "3424-20150709092700",
            "ConfigurationManager": {
                "Version": "11.10",
                "Name": "Chef"
            }
        },

~ Justin 🍻

* `berkshelf_version` - (Optional) If `manage_berkshelf` is enabled, the version of Berkshelf to use.
* `color` - (Optional) Color to paint next to the stack's resources in the OpsWorks console.
* `default_availability_zone` - (Optional) Name of the availability zone where instances will be created
Expand Down